IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo trait

Tensor

Metadata trait exposing a tensor's element type, known rank, and shape.

Implemented traits​

AnyType

comptime members​

dtype​

comptime dtype

rank​

comptime rank

Required methods​

shape​

def shape(self) -> Coord[*_Self._shape_types]

Returns the tensor's runtime shape.

Returns:

Coord[*_Self._shape_types]: The shape as a Coord, one element per dimension.

Was this page helpful?