nodeΒΆ
- onnx_ir.node(op_type: str, inputs: Sequence[ir.Value | None], attributes: Mapping[str, _convenience.SupportedAttrTypes] | None = None, *, domain: str = '', overload: str = '', num_outputs: int | None = None, outputs: Sequence[ir.Value] | None = None, version: int | None = None, graph: ir.Graph | None = None, name: str | None = None, doc_string: str | None = None, metadata_props: dict[str, str] | None = None) ir.Node ΒΆ
Create an
ir.Node
.This is a convenience constructor for creating a Node that supports Python objects as attributes.
Example:
>>> import onnx_ir as ir >>> input_a = ir.Input("A", shape=ir.Shape([1, 2]), type=ir.TensorType(ir.DataType.INT32)) >>> input_b = ir.Input("B", shape=ir.Shape([1, 2]), type=ir.TensorType(ir.DataType.INT32)) >>> node = ir.node( ... "SomeOp", ... inputs=[input_a, input_b], ... attributes={"alpha": 1.0, "some_list": [1, 2, 3]}, ... domain="some.domain", ... name="node_name" ... ) >>> node.op_type 'SomeOp'
- Parameters:
op_type β The name of the operator.
inputs β The input values. When an input is None, it is an empty input.
attributes β The attributes. RefAttr can be used only when the node is defined in a Function.
overload β The overload name when the node is invoking a function.
domain β The domain of the operator. For onnx operators, this is an empty string.
num_outputs β The number of outputs of the node. If not specified, the number is 1.
outputs β The output values. If None, the outputs are created during initialization.
version β The version of the operator. If None, the version is unspecified and will follow that of the graph.
graph β The graph that the node belongs to. If None, the node is not added to any graph. A Node must belong to zero or one graph.
name β The name of the node. If None, the node is anonymous.
doc_string β The documentation string.
metadata_props β The metadata properties.
- Returns:
A node with the given op_type and inputs.