Shortcuts

nerfacc.pack_data

nerfacc.pack_data(data, mask)

Pack per-ray data (n_rays, n_samples, D) to (all_samples, D) based on mask.

Parameters:
  • data (Tensor) – Tensor with shape (n_rays, n_samples, D).

  • mask (Tensor) – Boolen tensor with shape (n_rays, n_samples).

Returns:

Tuple of Tensors including packed data (all_samples, D), and packed_info (n_rays, 2) which stores the start index of the sample, and the number of samples kept for each ray.

Return type:

Tuple[Tensor, Tensor]

Examples:

data = torch.rand((10, 3, 4), device="cuda:0")
mask = data.rand((10, 3), dtype=torch.bool, device="cuda:0")
packed_data, packed_info = pack(data, mask)
print(packed_data.shape, packed_info.shape)