I’m trying to convert my pytorch model into onnx, my code is as below:
dummy_input = Variable(torch.randn(1, 3, 256, 256))
torch.onnx.export(model_G, dummy_input, “test.onnx”)
And terminal says:
Traceback (most recent call last):
File “Pkl2Onnx.py”, line 49, in 
torch.onnx.export(model_G, dummy_input, “test.onnx”)
File “/home/liuchang/.local/lib/python2.7/site-packages/torch/onnx/init.py”, line 25, in export
return utils.export(*args, **kwargs)
File “/home/liuchang/.local/lib/python2.7/site-packages/torch/onnx/utils.py”, line 84, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names)
File “/home/liuchang/.local/lib/python2.7/site-packages/torch/onnx/utils.py”, line 153, in _export
proto, export_map = trace.export(list(_unique_state_dict(model).values()),_onnx_opset_version, defer_weight_export)
IndexError: vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 173)
Has anyone met this problem before?