Shortcuts

nerfacc.pack_info

nerfacc.pack_info(ray_indices, n_rays=None)

Pack ray_indices to packed_info. Useful for converting per sample data to per ray data.

Note

this function is not differentiable to any inputs.

Parameters:
  • ray_indices (Tensor) – Ray indices of the samples. LongTensor with shape (n_sample).

  • n_rays (Optional[int]) – Number of rays. If None, it is inferred from ray_indices. Default is None.

Returns:

A LongTensor of shape (n_rays, 2) that specifies the start and count of each chunk in the flattened input tensor, with in total n_rays chunks.

Return type:

Tensor

Example:

>>> ray_indices = torch.tensor([0, 0, 1, 1, 1, 2, 2, 2, 2], device="cuda")
>>> packed_info = pack_info(ray_indices, n_rays=3)
>>> packed_info
tensor([[0, 2], [2, 3], [5, 4]], device='cuda:0')