Skip to content

Commit d7f4e80

Browse files
committed
one more fix
Signed-off-by: Edward Z. Yang <[email protected]>
1 parent 41c1ff6 commit d7f4e80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

torchvision/ops/roi_align.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ def from_K(t):
173173
val = torch.where(xmask[:, None, None, None, None, :], val, 0)
174174

175175
output = val.sum((-1, -2)) # remove IY, IX ~> [K, C, PH, PW]
176-
output /= count[:, None, None, None]
176+
if isinstance(count, torch.Tensor):
177+
output /= count[:, None, None, None]
178+
else:
179+
output /= count
177180

178181
output = output.to(orig_dtype)
179182

0 commit comments

Comments
 (0)