Skip to main content

Mojo module

managed_tensor_slice

Implements the ManagedTensorSlice type - a view of a tensor that doesn't own the underlying data. This type is used to build custom graph operations.

comptime values​

DynamicTensor​

comptime DynamicTensor[dtype: DType, rank: Int] = ManagedTensorSlice[IOUnknown, static_spec=_get_unknown_tensor_spec[dtype, rank]()]

Parameters​

  • ​dtype (DType):
  • ​rank (Int):

InputTensor​

comptime InputTensor = ManagedTensorSlice[Input, static_spec=?]

InputVariadicTensors​

comptime InputVariadicTensors = VariadicTensors[?, Input, static_specs=?]

OutputTensor​

comptime OutputTensor = ManagedTensorSlice[Output, static_spec=?]

OutputVariadicTensors​

comptime OutputVariadicTensors = VariadicTensors[?, Output, static_specs=?]

Structs​

  • ​ManagedTensorSlice: A view of a tensor that does not own the underlying allocated pointer. When the object lifetime ends it does not free the underlying pointer. Conversely, if a ManagedTensorSlice is created, it will not extend the life of the underlying pointer.
  • ​StaticTensorSpecList: A statically indexable list of data that can be assembled into a StaticTensorSpecList on demand. This handles the complexities that arise with heterogenous specs.
  • ​VariadicTensors: A tuple-like container of tensors representing variadic arguments from the graph compiler.

Functions​

  • ​foreach: Apply the function func to each element of the tensor slice.
  • ​trace_slice_arg: Helper to stringify the type and shape of a kernel argument for tracing.