onnx2pytorch icon indicating copy to clipboard operation
onnx2pytorch copied to clipboard

list index out of range

Open TestCandidate opened this issue 3 years ago • 1 comments

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)

TestCandidate avatar Dec 21 '21 09:12 TestCandidate

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

Talmaj avatar Nov 01 '25 23:11 Talmaj