Skip to content

Commit a3afb12

Browse files
authored
bug fix for torch.max operation
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument sgrvinod#2 'other' in call to _th_max
1 parent 9cad25b commit a3afb12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ def detect_objects(self, predicted_locs, predicted_scores, min_score, max_overla
491491

492492
# Suppress boxes whose overlaps (with this box) are greater than maximum overlap
493493
# Find such boxes and update suppress indices
494-
suppress = torch.max(suppress, overlap[box] > max_overlap)
494+
overlap_above_max = (overlap[box] > max_overlap).byte()
495+
suppress = torch.max(suppress, overlap_above_max)
495496
# The max operation retains previously suppressed boxes, like an 'OR' operation
496497

497498
# Don't suppress this box, even though it has an overlap of 1 with itself

0 commit comments

Comments
 (0)