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

Bail node adaptation if node has subgraph #146

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Change log
- Improved node creation speed by skipping the storing of the traceback
- :class:`spox.Var` objects may now be shallow copied. Deep copies are explicitly prohibited.

**Bug fix**

- Addresses node adaptation failure when referencing a non-input name from inside a subgraph by aborting opset adaptation.


0.10.2 (2023-02-08)
-------------------
Expand Down
3 changes: 3 additions & 0 deletions src/spox/_adapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import onnx
import onnx.version_converter

from ._attributes import AttrGraph
from ._inline import _Inline
from ._internal_op import _InternalNode
from ._node import Node
Expand Down Expand Up @@ -108,6 +109,8 @@ def adapt_best_effort(
)
if isinstance(node, _InternalNode) or len(protos) != 1:
return None
if any(isinstance(attr, AttrGraph) for attr in node.attrs.get_fields().values()):
return None
proto: onnx.NodeProto
(proto,) = protos
domain = proto.domain if proto.domain != "ai.onnx" else ""
Expand Down