Skip to main content

Mojo struct

StaticDim

A static tensor dimension.

Static tensor dimensions will always have exactly the same value, and are key to good model performance.

Static dimensions can be created implicitly in most cases: TensorType(DType.int64, 4, 5) is a tensor with 2 static dimensions, 4 and 5 respectively.

Fields

  • dim (SIMD[int64, 1]): The size of the static dimension.

Implemented traits

AnyType, CollectionElement, Copyable, Movable

Methods

__init__

__init__(out self, dim: Int)

Int conversion constructor.

Args:

  • dim (Int): The size of the static dimension.

__eq__

__eq__(self, other: Self) -> Bool

Whether the dimension has the same size as another dimension.

Args:

  • other (Self): The other dimension to check equality against.

Returns:

True if both dimensions have the same static size, False otherwise.