|
def | __init__ (self, str op, str name=None, Dict[str, object] attrs=None, List["Tensor"] inputs=None, List["Tensor"] outputs=None) |
|
def | i (self, tensor_idx=0, producer_idx=0) |
|
def | o (self, consumer_idx=0, tensor_idx=0) |
|
def | __setattr__ (self, name, value) |
|
def | copy (self, List["Tensor"] inputs=None, List["Tensor"] outputs=None) |
|
def | __str__ (self) |
|
def | __repr__ (self) |
|
def | __eq__ (self, other) |
|
◆ __init__()
def onnx_graphsurgeon.ir.node.Node.__init__ |
( |
|
self, |
|
|
str |
op, |
|
|
str |
name = None , |
|
|
Dict[str, object] |
attrs = None , |
|
|
List["Tensor"] |
inputs = None , |
|
|
List["Tensor"] |
outputs = None |
|
) |
| |
A node represents an operation in a graph, and consumes zero or more Tensors, and produces zero or more Tensors.
Args:
op (str): The operation this node performs.
name (str): The name of this node.
attrs (Dict[str, object]): A dictionary that maps attribute names to their values.
inputs (List[Tensor]): A list of zero or more input Tensors.
outputs (List[Tensor]): A list of zero or more output Tensors.
◆ i()
def onnx_graphsurgeon.ir.node.Node.i |
( |
|
self, |
|
|
|
tensor_idx = 0 , |
|
|
|
producer_idx = 0 |
|
) |
| |
Convenience function to get a producer node of one of this node's input tensors.
Note that the parameters are swapped compared to the o() function; this is because tensors are likely to have only a single producer
For example:
::
assert node.i() == node.inputs[0].inputs[0]
assert node.i(1, 2) == node.inputs[1].inputs[2]
Args:
tensor_idx (int): The index of the input tensor of this node. Defaults to 0.
producer_idx (int): The index of the producer of the input tensor, if the tensor has multiple producers. Defaults to 0
Returns:
Node: The specified producer (input) node.
◆ o()
def onnx_graphsurgeon.ir.node.Node.o |
( |
|
self, |
|
|
|
consumer_idx = 0 , |
|
|
|
tensor_idx = 0 |
|
) |
| |
Convenience function to get a consumer node of one of this node's output tensors.
For example:
::
assert node.o() == node.outputs[0].outputs[0]
assert node.o(2, 1) == node.outputs[1].outputs[2]
Args:
consumer_idx (int): The index of the consumer of the input tensor. Defaults to 0.
tensor_idx (int): The index of the output tensor of this node, if the node has multiple outputs. Defaults to 0.
Returns:
Node: The specified consumer (output) node
◆ __setattr__()
def onnx_graphsurgeon.ir.node.Node.__setattr__ |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
◆ copy()
def onnx_graphsurgeon.ir.node.Node.copy |
( |
|
self, |
|
|
List["Tensor"] |
inputs = None , |
|
|
List["Tensor"] |
outputs = None |
|
) |
| |
Makes a shallow copy of this node, overriding input and output information.
Note: Generally, you should only ever make a deep copy of a Graph.
◆ __str__()
def onnx_graphsurgeon.ir.node.Node.__str__ |
( |
|
self | ) |
|
◆ __repr__()
def onnx_graphsurgeon.ir.node.Node.__repr__ |
( |
|
self | ) |
|
◆ __eq__()
def onnx_graphsurgeon.ir.node.Node.__eq__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Check whether two nodes are equal by comparing name, attributes, op, inputs, and outputs.
◆ op
onnx_graphsurgeon.ir.node.Node.op |
◆ name
onnx_graphsurgeon.ir.node.Node.name |
◆ attrs
onnx_graphsurgeon.ir.node.Node.attrs |
◆ inputs
onnx_graphsurgeon.ir.node.Node.inputs |
◆ outputs
onnx_graphsurgeon.ir.node.Node.outputs |
The documentation for this class was generated from the following file: