Mojo struct
VariadicTensors
@register_passable(trivial)
struct VariadicTensors[mut: Bool, input: IO, //, dtype: DType, rank: Int, size: Int, io_spec: IOSpec[mut, input], *, static_specs: StaticTuple[StaticTensorSpec[dtype, rank], size]]
A tuple-like container of tensors representing variadic arguments from the graph compiler.
Implemented traits
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
RegisterPassable,
Sized,
TrivialRegisterPassable
comptime members
__copyinit__is_trivial
comptime __copyinit__is_trivial = True
__del__is_trivial
comptime __del__is_trivial = True
__moveinit__is_trivial
comptime __moveinit__is_trivial = True
Methods
__init__
__init__(ptrs: StaticTuple[LegacyUnsafePointer[Scalar[dtype]], 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.
__getitem__
__getitem__[index: Int](self) -> ManagedTensorSlice[io_spec, static_spec=static_specs.__getitem__[StaticTensorSpec[dtype, rank], size](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: The tensor at the specified index.
__len__
__len__(self) -> Int
Returns the number of variadic arguments in the pack.
Returns:
Int: The number of variadic arguments.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!