Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liaogulou committed Apr 9, 2024
1 parent d5ccb49 commit 9339150
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions easycv/apis/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ def _export_cls(model, cfg, filename):
if model_config['backbone'].get(
'type', None) == 'ResNet' and model_config['backbone'].get(
'depth', None) == 50:

device = 'cuda' if torch.cuda.is_available() else 'cpu'
model.eval()
model.to(device)
img_size = int(cfg.image_size2)
x_input = torch.randn((1, 3, img_size, img_size))
x_input = torch.randn((1, 3, img_size, img_size)).to(device)
torch.onnx.export(
model,
(x_input, 'test'),
Expand Down

0 comments on commit 9339150

Please sign in to comment.