Skip to main content

Mojo struct

DynamicDim

A dynamic tensor dimension.

DynamicDims are printed in MO tensor types as ?, eg. !mo.tensor<[?, 4, ?], si32]> has 2 dynamic dimensions.

Dynamic dimensions reduce the compiler's ability to reason about tensor shapes as data moves through the model, and may therefore limit the available optimizations it can perform. Reducing usage of dynamic dims can be an avenue to improving model performance.

Create a dynamic dimension via Dim.dynamic().

Implemented traits

AnyType, CollectionElement, Copyable, Movable