Skip to content

Commit

Permalink
Transfer to cpu only when torch.Tensor arguments in onnx export
Browse files Browse the repository at this point in the history
  • Loading branch information
take-cheeze authored Nov 19, 2024
1 parent 3f8604b commit 3152a27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mmdeploy/apis/onnx/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def wrapper(*arg, **kwargs):
if isinstance(args, torch.Tensor):
args = args.cpu()
elif isinstance(args, (tuple, list)):
args = tuple([_.cpu() for _ in args])
args = tuple([_.cpu() if isinstance(_, torch.Tensor) else _ for _ in args])
else:
raise RuntimeError(f'Not supported args: {args}')
torch.onnx.export(
Expand Down

0 comments on commit 3152a27

Please sign in to comment.