Skip to content

Commit e547490

Browse files
authored
scatter_add_ -> index_add_ (#179)
1 parent 9a1c0ab commit e547490

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

nerfacc/vol_rendering.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ def accumulate_along_rays(
190190
n_rays = int(ray_indices.max()) + 1
191191
# assert n_rays > ray_indices.max()
192192

193-
index = ray_indices[:, None].expand(-1, src.shape[-1])
194193
outputs = torch.zeros(
195194
(n_rays, src.shape[-1]), device=src.device, dtype=src.dtype
196195
)
197-
outputs.scatter_add_(0, index, src)
196+
outputs.index_add_(0, ray_indices, src)
198197
return outputs
199198

200199

0 commit comments

Comments
 (0)