Get code running

This commit is contained in:
Matt Tancik committed 2022-04-20 12:24:08 -07:00
1 parent 5ee9669b2c
commit 4325c86997
4 files changed
+79 -43

No files matched your search

+4 -8
View File
@@ -72,14 +72,10 @@ class RaySamples:
def __init__(
self,
t_min: TensorType["num_rays"],
t_max: TensorType["num_rays"],
ts: TensorType["num_rays", "num_samples+1"],
bins: TensorType["num_rays", "num_samples+1"],
ray_bundle: RayBundle,
) -> None:
self.t_min = t_min
self.t_max = t_max
self.ts = ts
self.bins = bins
self.positions = self.get_positions(ray_bundle)
self.directions = ray_bundle.directions.unsqueeze(1).repeat(1, self.positions.shape[1], 1)
self.deltas = self.get_deltas()
@@ -87,11 +83,11 @@ class RaySamples:
def get_positions(self, ray_bundle: RayBundle) -> TensorType["num_rays", "num_samples", 3]:
"""Returns positions."""
# TODO(ethan): check with Matt about this
t_mid = (self.ts[:, 1:] + self.ts[:, :-1]) / 2 # (num_rays, num_samples)
t_mid = (self.bins[:, 1:] + self.bins[:, :-1]) / 2 # (num_rays, num_samples)
return ray_bundle.origins[:, None] + t_mid[:, :, None] * ray_bundle.directions[:, None]
def get_deltas(self) -> TensorType["num_samples"]:
"""Returns deltas."""
deltas = self.ts[..., 1:] - self.ts[..., :-1]
deltas = self.bins[..., 1:] - self.bins[..., :-1]
# TODO(ethan): check this with Matt
return deltas