Attr¶

class onnx_ir.Attr(name: str, type: AttributeType, value: Any, ref_attr_name: str | None = None, *, doc_string: str | None = None)¶

Base class for ONNX attributes or references.

doc_string¶
as_float() float[source]¶

Get the attribute value as a float.

as_floats() Sequence[float][source]¶

Get the attribute value as a sequence of floats.

as_graph() Graph[source]¶

Get the attribute value as a graph.

as_graphs() Sequence[Graph][source]¶

Get the attribute value as a sequence of graphs.

as_int() int[source]¶

Get the attribute value as an int.

as_ints() Sequence[int][source]¶

Get the attribute value as a sequence of ints.

as_string() str[source]¶

Get the attribute value as a string.

as_strings() Sequence[str][source]¶

Get the attribute value as a sequence of strings.

as_tensor() TensorProtocol[source]¶

Get the attribute value as a tensor.

as_tensors() Sequence[TensorProtocol][source]¶

Get the attribute value as a sequence of tensors.

display(*, page: bool = False) None¶

Pretty print the object.

Parameters:

page – Whether to page the output.

is_ref() bool[source]¶

Check if this attribute is a reference attribute.

property name: str¶
property ref_attr_name: str | None¶
property type: AttributeType¶
property value: Any¶