Skip to content
Merged
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
6 changes: 4 additions & 2 deletions backends/nxp/neutron_node_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def extract_artifacts_from_neutron_node(

if sub_graph.OperatorsLength() == 0:
raise RuntimeError(
"Model converted with neutron-converter has `0` operators instead of `1`."
"Model converted with neutron-converter has `0` operators instead of `1`.",
sub_graph.OperatorsLength(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've already hardcoded to zero, you can remove this

Copy link
Collaborator Author

@StrycekSimon StrycekSimon Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know how I missed this one...

Edit: Apparently, it is there just to be consistent with the other errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeStevens , maybe I missunderstood your point, but the first check verifies there is only one subgraph in the Neutron IR flatbuffer (subgraph is like the pytorch's method). And this check verifies now many nodes are in the first subgraph.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeStevens , maybe I missunderstood your point, but the first check verifies there is only one subgraph in the Neutron IR flatbuffer (subgraph is like the pytorch's method). And this check verifies now many nodes are in the first subgraph.

I just mean that sub_graph.OperatorsLength() does not offer any more information in this case for the RuntimeError, since sub_graph.OperatorsLength == 0 and that is explicitly written out in the string already

)
elif sub_graph.OperatorsLength() > 1:
builtin_operators_map: dict[int, str] = {
Expand All @@ -61,7 +62,8 @@ def extract_artifacts_from_neutron_node(

raise RuntimeError(
f"Model converted with neutron-converter has `{sub_graph.OperatorsLength()}` operators "
f'instead of `1`. Operators found: {", ".join(ops_found)}.'
f'instead of `1`. Operators found: {", ".join(ops_found)}.',
sub_graph.OperatorsLength(),
)

neutron_node = None
Expand Down
Loading