@@ -1296,6 +1296,9 @@ class Node(_protocols.NodeProtocol, _display.PrettyPrintable):
1296
1296
To change the output values, create a new node and replace the each of the inputs of ``output.uses()`` with
1297
1297
the new output values by calling :meth:`replace_input_with` on the using nodes
1298
1298
of this node's outputs.
1299
+
1300
+ .. note:
1301
+ When the ``domain`` is `"ai.onnx"`, it is normalized to `""`.
1299
1302
"""
1300
1303
1301
1304
__slots__ = (
@@ -1333,7 +1336,7 @@ def __init__(
1333
1336
1334
1337
Args:
1335
1338
domain: The domain of the operator. For onnx operators, this is an empty string.
1336
- When it is "ai.onnx", it is normalized to "" .
1339
+ When it is ` "ai.onnx"` , it is normalized to `""` .
1337
1340
op_type: The name of the operator.
1338
1341
inputs: The input values. When an input is ``None``, it is an empty input.
1339
1342
attributes: The attributes. RefAttr can be used only when the node is defined in a Function.
@@ -1476,6 +1479,7 @@ def __repr__(self) -> str:
1476
1479
1477
1480
@property
1478
1481
def name (self ) -> str | None :
1482
+ """Optional name of the node."""
1479
1483
return self ._name
1480
1484
1481
1485
@name .setter
@@ -1484,6 +1488,11 @@ def name(self, value: str | None) -> None:
1484
1488
1485
1489
@property
1486
1490
def domain (self ) -> str :
1491
+ """The domain of the operator. For onnx operators, this is an empty string.
1492
+
1493
+ .. note:
1494
+ When domain is `"ai.onnx"`, it is normalized to `""`.
1495
+ """
1487
1496
return self ._domain
1488
1497
1489
1498
@domain .setter
@@ -1492,6 +1501,13 @@ def domain(self, value: str) -> None:
1492
1501
1493
1502
@property
1494
1503
def version (self ) -> int | None :
1504
+ """Opset version of the operator called.
1505
+
1506
+ If ``None``, the version is unspecified and will follow that of the graph.
1507
+ This property is special to ONNX IR to allow mixed opset usage in a graph
1508
+ for supporting more flexible graph transformations. It does not exist in the ONNX
1509
+ serialization (protobuf) spec.
1510
+ """
1495
1511
return self ._version
1496
1512
1497
1513
@version .setter
@@ -1500,6 +1516,7 @@ def version(self, value: int | None) -> None:
1500
1516
1501
1517
@property
1502
1518
def op_type (self ) -> str :
1519
+ """The name of the operator called."""
1503
1520
return self ._op_type
1504
1521
1505
1522
@op_type .setter
@@ -1508,6 +1525,7 @@ def op_type(self, value: str) -> None:
1508
1525
1509
1526
@property
1510
1527
def overload (self ) -> str :
1528
+ """The overload name when the node is invoking a function."""
1511
1529
return self ._overload
1512
1530
1513
1531
@overload .setter
@@ -1516,6 +1534,12 @@ def overload(self, value: str) -> None:
1516
1534
1517
1535
@property
1518
1536
def inputs (self ) -> Sequence [Value | None ]:
1537
+ """The input values of the node.
1538
+
1539
+ The inputs are immutable. To change the inputs, create a new node and
1540
+ replace the inputs of the using nodes of this node's outputs by calling
1541
+ :meth:`replace_input_with` on the using nodes of this node's outputs.
1542
+ """
1519
1543
return self ._inputs
1520
1544
1521
1545
@inputs .setter
@@ -1596,6 +1620,12 @@ def append(self, /, nodes: Node | Iterable[Node]) -> None:
1596
1620
1597
1621
@property
1598
1622
def outputs (self ) -> Sequence [Value ]:
1623
+ """The output values of the node.
1624
+
1625
+ The outputs are immutable. To change the outputs, create a new node and
1626
+ replace the inputs of the using nodes of this node's outputs by calling
1627
+ :meth:`replace_input_with` on the using nodes of this node's outputs.
1628
+ """
1599
1629
return self ._outputs
1600
1630
1601
1631
@outputs .setter
@@ -1604,6 +1634,7 @@ def outputs(self, _: Sequence[Value]) -> None:
1604
1634
1605
1635
@property
1606
1636
def attributes (self ) -> OrderedDict [str , Attr | RefAttr ]:
1637
+ """The attributes of the node."""
1607
1638
return self ._attributes
1608
1639
1609
1640
@property
@@ -1619,22 +1650,39 @@ def meta(self) -> _metadata.MetadataStore:
1619
1650
1620
1651
@property
1621
1652
def metadata_props (self ) -> dict [str , str ]:
1653
+ """The metadata properties of the node.
1654
+
1655
+ The metadata properties are used to store additional information about the node.
1656
+ Unlike ``meta``, this property is serialized to the ONNX proto.
1657
+ """
1622
1658
if self ._metadata_props is None :
1623
1659
self ._metadata_props = {}
1624
1660
return self ._metadata_props
1625
1661
1626
1662
@property
1627
1663
def graph (self ) -> Graph | None :
1664
+ """The graph that the node belongs to.
1665
+
1666
+ If the node is not added to any graph, this property is None.
1667
+ """
1628
1668
return self ._graph
1629
1669
1630
1670
@graph .setter
1631
1671
def graph (self , value : Graph | None ) -> None :
1632
1672
self ._graph = value
1633
1673
1634
1674
def op_identifier (self ) -> _protocols .OperatorIdentifier :
1675
+ """Return the operator identifier of the node.
1676
+
1677
+ The operator identifier is a tuple of the domain, op_type and overload.
1678
+ """
1635
1679
return self .domain , self .op_type , self .overload
1636
1680
1637
1681
def display (self , * , page : bool = False ) -> None :
1682
+ """Pretty print the node.
1683
+
1684
+ This method is used for debugging and visualization purposes.
1685
+ """
1638
1686
# Add the node's name to the displayed text
1639
1687
print (f"Node: { self .name !r} " )
1640
1688
if self .doc_string :
0 commit comments