Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: Always index into squence-like outputs #201

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion onnx2torch/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ def convert( # pylint: disable=too-many-locals, too-many-branches, too-many-sta
torch_input_node = torch_nodes[onnx_input_node.unique_name]

# Get only one needed output of torch_input_node by index
if len(onnx_input_node.output_values) > 1:
if len(onnx_input_node.output_values) > 1 or onnx_input_node.proto.op_type in (
'If',
'Loop',
'Scan',
'SequenceMap',
'Split',
):
index = onnx_input_node.output_values.index(value_name)
torch_input_node = torch_graph.call_function(getitem, args=(torch_input_node, index))
torch_nodes[name + '_split_output'] = torch_input_node
Expand Down
Loading