onnx2pytorch
onnx2pytorch copied to clipboard
list index out of range
I am facing this error when converting an onnx model using ConvertModel function:
/usr/local/lib/python3.7/dist-packages/onnx2pytorch/convert/operations.py in convert_operations(onnx_graph, opset_version, batch_dim, enable_pruning)
157
158 # check if next node Add to add bias
--> 159 next_node = onnx_graph.node[i + 1]
160 next_params = [
161 weights[par_name]
IndexError: list index (74) out of range
my code:
onnx_model = onnx.load(load_model_path)
torch_model = ConvertModel(onnx_model)
There's a fix for this that's still in PR: #28 . Hopefully we'll have it merged in shortly, but until then you can use the code in that fork.
Fixed in v0.5.2