Skip to main content
Log in

Mojo struct

ListType

struct ListType

A type representing a flat list of tensor values.

This isn't an eager list type! It doesn't contain any data, but represents a runtime list that contains tensors.

Fields

  • eltype (TensorType): The tensor type of elements in the list. The list can currently only hold tensors, and it has a single known tensor type. If the list can contain tensors of different shapes, they need to conform to that tensor type. For instance, a list with tensors of shapes [batch, x, 2, 4] and [batch, 1, 2, ?] would need to represent its type as [batch, ?, 2, ?], holding dynamic dimensions for those that vary among its list elements.

    Lists may not contain tensor elements of different ranks.

Implemented traits

AnyType, CollectionElement, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

__init__

@implicit __init__(out self, eltype: TensorType)

to_mlir

to_mlir(self, ctx: Context) -> Type

Converts to an _mlir.Type instance.

Args:

  • ctx (Context): The mlir.Context in which to create the type.

Returns:

An _mlir.Type in the specified Context.