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 struct
StableVariadicTensors
struct StableVariadicTensors[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 StableTensors representing variadic arguments from the graph compiler.
The graph compiler builds it from one stable address slot and one runtime
shape per element; each element's data pointer is read out of its slot on
the device, so a device graph recorded against the pack can be retargeted
with DeviceGraphBuilder.place_stable()
before each replay.
Parameters
- mut (
Bool): Whether the tensors are mutable. - input (
IO): The IO kind of the tensors. - dtype (
DType): The element type of the tensors. - rank (
Int): The rank of the tensors. - size (
Int): The number of tensors in the pack. - io_spec (
IOSpec[mut, input]): The IO specification shared by every tensor. - static_specs (
StaticTensorSpecList[static_specs.internals_list, static_specs.shapes_list, static_specs.strides_list]): The per-element static specifications.
Implemented traits
AnyType,
Copyable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
Sized,
TrivialRegisterPassable
Methods
__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) -> StableTensor[io_spec, static_spec=static_specs.__getitem_param__[index]()]
Returns the tensor at the given position in the variadic argument pack.
Parameters:
- index (
Int): The index into the variadic tensor arguments.
Returns:
StableTensor[io_spec, static_spec=static_specs.__getitem_param__[index]()]: The stable tensor view at the specified index.
to_tile_tensor
def to_tile_tensor(self, out result: Array[TileTensor[dtype, Layout[TypeList[#kgen.param_list.tabulate(rank, [idx: __mlir_type.index] ComptimeInt[static_specs.shapes_list.values[SIMDLength(Int(0))][Int(idx)]] if (xor identical((xor (lt static_specs.shapes_list.values[SIMDLength(Int(0))][Int(idx)], 0), True), False), True) else Int)](), TypeList[#kgen.param_list.tabulate(rank, [idx: __mlir_type.index] ComptimeInt[static_specs.strides_list.values[SIMDLength(Int(0))][Int(idx)]] if (xor identical((xor (lt static_specs.strides_list.values[SIMDLength(Int(0))][Int(idx)], 0), True), False), True) else Int)]()], MutUntrackedOrigin, Engine=StableAddrEngine], size])
Returns: