glenn-jocher commited on
Commit
1993efd
1 Parent(s): 406ee52

Swap `unsafe_chunk()` for `chunk()` (#7362)

Browse files

Eliminates all unsafe function in YOLOv5 out of an abundance of caution.

Files changed (1) hide show
  1. utils/loss.py +1 -1
utils/loss.py CHANGED
@@ -220,7 +220,7 @@ class ComputeLoss:
220
  offsets = 0
221
 
222
  # Define
223
- bc, gxy, gwh, a = t.unsafe_chunk(4, dim=1) # (image, class), grid xy, grid wh, anchors
224
  a, (b, c) = a.long().view(-1), bc.long().T # anchors, image, class
225
  gij = (gxy - offsets).long()
226
  gi, gj = gij.T # grid indices
 
220
  offsets = 0
221
 
222
  # Define
223
+ bc, gxy, gwh, a = t.chunk(4, 1) # (image, class), grid xy, grid wh, anchors
224
  a, (b, c) = a.long().view(-1), bc.long().T # anchors, image, class
225
  gij = (gxy - offsets).long()
226
  gi, gj = gij.T # grid indices