nerfacc.exclusive_prod¶
- nerfacc.exclusive_prod(inputs, packed_info=None)¶
Exclusive Product that supports flattened tensor.
Similar to
nerfacc.inclusive_prod()
, but computes the exclusive product.- Parameters:
inputs (Tensor) – The tensor to be producted. Can be either a N-D tensor, or a flattened tensor with packed_info specified.
packed_info (Optional[Tensor]) – A tensor 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. If None, the input is assumed to be a N-D tensor and the product is computed along the last dimension. Default is None.
- Returns:
The exclusive product with the same shape as the input tensor.
- Return type:
Tensor
Example:
>>> inputs = torch.tensor([1., 2., 3., 4., 5., 6., 7., 8., 9.], device="cuda") >>> packed_info = torch.tensor([[0, 2], [2, 3], [5, 4]], device="cuda") >>> exclusive_prod(inputs, packed_info) tensor([1., 1., 1., 3., 12., 1., 6., 42., 336.], device='cuda:0')