Skip to main content

attr

Attribute primitives.

Attributes are key-value pairs that can be attached to a Node, Graph and other elements. Attributes are similar to inputs, except they are constant - their value doesn't change at runtime. The attribute name is always a string.

For exmple, mo.constant has a value attribute, representing the value of the constant it holds.

Attributes can hold various types of values, including primitive values, lists, tensors, etc.

AttrMap

Holds a set of attributes.

Fields:

  • attrs (List[NamedAttribute]): The list of attributes held by this map.

Implemented traits:

AnyType, Copyable, Movable, Sized

Methods:

__init__

__init__(inout self: Self, *attrs: NamedAttribute)

Constructs an AttrMap from internal Attribute representations.

Args:

  • attrs (*NamedAttribute): Variadic list of internal Attribute representations.

__len__

__len__(self: Self) -> Int

Returns the size of this map.