Skip to content

Commit 1993efd

Browse files
authored
Swap unsafe_chunk() for chunk() (#7362)
Eliminates all unsafe function in YOLOv5 out of an abundance of caution.
1 parent 406ee52 commit 1993efd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/loss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def build_targets(self, p, targets):
220220
offsets = 0
221221

222222
# Define
223-
bc, gxy, gwh, a = t.unsafe_chunk(4, dim=1) # (image, class), grid xy, grid wh, anchors
223+
bc, gxy, gwh, a = t.chunk(4, 1) # (image, class), grid xy, grid wh, anchors
224224
a, (b, c) = a.long().view(-1), bc.long().T # anchors, image, class
225225
gij = (gxy - offsets).long()
226226
gi, gj = gij.T # grid indices

0 commit comments

Comments
 (0)