Serializing JSON code for drawable objects (and some documentation) (#222)

* some comments and starting serializing comments. on plane w/o formatter

* fixing pylint and black

* removed changes in file

* revert file

* addressing comments

* remove abstract

Co-authored-by: Ethan Weber <ethanweber@Ethans-MacBook-Pro.local>
This commit is contained in:
Ethan WeberandEthan Weber authored and GitHub committed 2022-07-28 13:55:58 -05:00
1 parent 44a7fa288c
commit d13a766b9e
13 files changed
+240 -106

No files matched your search

+4 -14
View File
@@ -98,9 +98,9 @@ class RaySamples(TensorDataclass):
"""
frustums: Frustums
camera_indices: TensorType["bs":..., 1] = None
valid_mask: TensorType["bs":..., 1] = None
deltas: TensorType["bs":..., 1] = None
camera_indices: Optional[TensorType["bs":..., 1]] = None
valid_mask: Optional[TensorType["bs":..., 1]] = None
deltas: Optional[TensorType["bs":..., 1]] = None
def get_weights(self, densities: TensorType[..., "num_samples", 1]) -> TensorType[..., "num_samples", 1]:
"""Return weights based on predicted densities
@@ -115,6 +115,7 @@ class RaySamples(TensorDataclass):
delta_density = self.deltas * densities
alphas = 1 - torch.exp(-delta_density)
# TODO: put both versions of the transmittance calculation somewhere
# mip-nerf version of transmittance calculation:
transmittance = torch.cumsum(delta_density[..., :-1, :], dim=-2)
transmittance = torch.cat(
@@ -170,17 +171,6 @@ class RayBundle(TensorDataclass):
valid_mask: Optional[TensorType["num_rays", 1, bool]] = None
num_rays_per_chunk: int = None
def move_to_device(self, device: torch.device) -> None:
"""Move bundle data to a device.
Args:
device (torch.device): Device to move tensors to.
"""
self.origins = self.origins.to(device)
self.directions = self.directions.to(device)
if is_not_none(self.camera_indices):
self.camera_indices = self.camera_indices.to(device)
def set_camera_indices(self, camera_index: int) -> None:
"""Sets all of the the camera indices to a specific camera index.