Skip to content

Commit 582d12a

Browse files
authored
Fix draw_bounding_boxes for tensors on GPU (#5101)
1 parent 237e0b4 commit 582d12a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchvision/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def draw_bounding_boxes(
189189
if image.size(0) == 1:
190190
image = torch.tile(image, (3, 1, 1))
191191

192-
ndarr = image.permute(1, 2, 0).numpy()
192+
ndarr = image.permute(1, 2, 0).cpu().numpy()
193193
img_to_draw = Image.fromarray(ndarr)
194194

195195
img_boxes = boxes.to(torch.int64).tolist()

0 commit comments

Comments
 (0)