Open ItzDerock opened 1 year ago
fixes #270
for torch == 1.13.0
just fix it
utils/loss.py
-> 130 gain = torch.ones(6, device=targets.device, dtype=torch.long) # normalized to gridspace gain -> 138 gain[2:] = torch.tensor(p[i].shape, dtype=torch.long)[[3, 2, 3, 2]] # xyxy gain -> 144 at = torch.arange(na, device=targets.device).view(na, 1).repeat(1, nt) # anchor tensor, same as .repeat_interleave(nt)
This PR re-implements the patch done in ultralytics/yolov5 pr 8067 to fix this error when using torch 1.12