Skip to content

Commit

Permalink
Bail node adaptation if node has subgraph (#146)
Browse files Browse the repository at this point in the history
Bail node adaptation if node has subgraph
  • Loading branch information
adityagoel4512 authored Mar 13, 2024
1 parent 70488bb commit e325278
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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

0 comments on commit e325278

Please sign in to comment.