Skip to content

Commit

Permalink
DetectMultiBackend() return device update (ultralytics#6958)
Browse files Browse the repository at this point in the history
Fixes ONNX validation that returns outputs on CPU.
  • Loading branch information
glenn-jocher committed Mar 12, 2022
1 parent 24d8af9 commit 42ec267
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ def forward(self, im, augment=False, visualize=False, val=False):
y = (y.astype(np.float32) - zero_point) * scale # re-scale
y[..., :4] *= [w, h, w, h] # xywh normalized to pixels

y = torch.tensor(y) if isinstance(y, np.ndarray) else y
if isinstance(y, np.ndarray):
y = torch.tensor(y, device=self.device)
return (y, []) if val else y

def warmup(self, imgsz=(1, 3, 640, 640)):
Expand Down

0 comments on commit 42ec267

Please sign in to comment.