Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

As per the example given in torch documentation https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html

Your code should be :

dummy_input = torch.randn(batch_size, 3, 224, 224) # !not a constant batch size torch.randn(1, 3, 224, 224) toorch.onnx.export(model, dummy_input, onnx_name, do_constant_folding=True, input_names = ['input'], # the model's input names output_names = ['output'], dynamic_axes={'input' : {0 : 'batch_size'}, # variable lenght axes 'output' : {0 : 'batch_size'}})

Hi,

As per the example given in torch documentation https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html

Your code should be :

: batch_size=1# random initialization dummy_input = torch.randn(batch_size, 3, 224, 224) # !not a constant batch size torch.randn(1, 3, 224, 224) toorch.onnx.export(model, dummy_input, onnx_name, do_constant_folding=True, input_names = ['input'], # the model's input names output_names = ['output'], dynamic_axes={'input' : {0 : 'batch_size'}, # variable lenght axes 'output' : {0 : 'batch_size'}})

Hi,

As per the example given in torch documentation https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html

Your code should be : :

batch_size=1# random initialization
 dummy_input = torch.randn(batch_size, 3, 224, 224)  
toorch.onnx.export(model, dummy_input, onnx_name,
                  do_constant_folding=True, 
                  input_names = ['input'],   # the model's input names
                  output_names = ['output'],
                  dynamic_axes={'input' : {0 : 'batch_size'},  # variable lenght axes
                            'output' : {0 : 'batch_size'}})

'batch_size'}})

Hi,

As per the example given in torch documentation https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html

Your code should be :

batch_size=1# random initialization

dummy_input = torch.randn(batch_size, 3, 224, 224) 
dynamic_axes = {'input' : {0 : 'batch_size'},  toorch.onnx.export(model,                             'output' : {0 : 'batch_size'}}
torch.onnx.export(model, dummy_input, onnx_name,
                  do_constant_folding=True, 
                  input_names = ['input'],   # the model's input names
                  output_names = ['output'],
                  dynamic_axes={'input' : {0 : 'batch_size'}, # variable lenght axes
                            'output' : {0 : 'batch_size'}})
dynamic_axes=dynamic_axes)