Skip to content

Commit

Permalink
Update loss for FP16 tobj (ultralytics#7088)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Mar 21, 2022
1 parent 535f285 commit bb378e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __call__(self, p, targets): # predictions, targets
# Losses
for i, pi in enumerate(p): # layer index, layer predictions
b, a, gj, gi = indices[i] # image, anchor, gridy, gridx
tobj = torch.zeros(pi.shape[:4], device=self.device) # target obj
tobj = torch.zeros(pi.shape[:4], dtype=pi.dtype, device=self.device) # target obj

n = b.shape[0] # number of targets
if n:
Expand Down

0 comments on commit bb378e4

Please sign in to comment.