fixed an exception bug in case of num_samples is 0 (#1198)

fixed an exception bug when num samples is 0 , 
"IndexError tensors used as indices must be long, byte or bool tensors"

change type to long ( was float32)
This commit is contained in:
dozeri83 authored and GitHub committed 2023-01-01 17:14:55 -07:00
1 parent 5710b09b6d
commit fa6f279751
1 file changed
+1 -1
+1 -1
View File
@@ -472,7 +472,7 @@ class VolumetricSampler(Sampler):
if num_samples == 0:
# create a single fake sample and update packed_info accordingly
# this says the last ray in packed_info has 1 sample, which starts and ends at 1
ray_indices = torch.zeros((1,), dtype=starts.dtype, device=rays_o.device)
ray_indices = torch.zeros((1,), dtype=torch.long, device=rays_o.device)
starts = torch.ones((1, 1), dtype=starts.dtype, device=rays_o.device)
ends = torch.ones((1, 1), dtype=ends.dtype, device=rays_o.device)