Attr¶

class onnx_ir.Attr(name, type, value, ref_attr_name=None, *, doc_string=None)¶

Base class for ONNX attributes or references.

Parameters:
  • name (str)

  • type (_enums.AttributeType)

  • value (Any)

  • ref_attr_name (str | None)

  • doc_string (str | None)

doc_string¶
as_float()[source]¶

Get the attribute value as a float.

Return type:

float

as_floats()[source]¶

Get the attribute value as a sequence of floats.

Return type:

Sequence[float]

as_graph()[source]¶

Get the attribute value as a graph.

Return type:

Graph

as_graphs()[source]¶

Get the attribute value as a sequence of graphs.

Return type:

Sequence[Graph]

as_int()[source]¶

Get the attribute value as an int.

Return type:

int

as_ints()[source]¶

Get the attribute value as a sequence of ints.

Return type:

Sequence[int]

as_string()[source]¶

Get the attribute value as a string.

Return type:

str

as_strings()[source]¶

Get the attribute value as a sequence of strings.

Return type:

Sequence[str]

as_tensor()[source]¶

Get the attribute value as a tensor.

Return type:

TensorProtocol

as_tensors()[source]¶

Get the attribute value as a sequence of tensors.

Return type:

Sequence[TensorProtocol]

display(*, page=False)¶

Pretty print the object.

Parameters:

page (bool) – Whether to page the output.

Return type:

None

is_ref()[source]¶

Check if this attribute is a reference attribute.

Return type:

bool

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