IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo struct

VariadicTensors

struct VariadicTensors[mut: Bool, input: IO, dtype: DType, rank: Int, //, size: Int, io_spec: IOSpec[mut, input], *, static_specs: StaticTensorSpecList[static_specs.internals_list, static_specs.shapes_list, static_specs.strides_list]]

A tuple-like container of tensors representing variadic arguments from the graph compiler.

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, Sized, TrivialRegisterPassable

Methods​

__init__​

def __init__(ptrs: StaticTuple[UnsafePointer[Scalar[dtype], MutAnyOrigin], size], shapes: StaticTuple[IndexList[rank], size]) -> Self

Initialize the variadic tensor from tuples of pointers and shapes.

This is a bulk initialization of the VariadicTensors value from an array of pointers and an array of runtime shapes. This allows the graph compiler to avoid generating code to construct DynamicTensor values directly.

__len__​

def __len__(self) -> Int

Returns the number of variadic arguments in the pack.

Returns:

Int: The number of variadic arguments.

__getitem_param__​

def __getitem_param__[index: Int](self) -> ManagedTensorSlice[io_spec, static_spec=static_specs.__getitem_param__[index]()]

Returns the tensor at the given position in the variadic argument argument pack.

Parameters:

  • ​index (Int): The index into the variadic tensor arguments.

Returns:

ManagedTensorSlice[io_spec, static_spec=static_specs.__getitem_param__[index]()]: The tensor at the specified index.