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

Mojo function

to_tile_tensor

def to_tile_tensor[TensorType: Tensor, //, *, mut: Bool = False](tensor: TensorType) -> TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, UntrackedOrigin[mut], Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]

Projects a tensor argument to a TileTensor view.

Deprecated: call tensor.to_tile_tensor(), the TileTensorable method, instead. Refine a Tensor-bound argument with conforms_to first.

Constraints:

TensorType must conform to TileTensorable.

Parameters:

  • ​TensorType (Tensor): The tensor-argument type (inferred).
  • ​mut (Bool): Whether to project a mutable view (defaults to immutable).

Args:

  • ​tensor (TensorType): The tensor argument to project.

Returns:

TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, UntrackedOrigin[mut], Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]: A TileTensor view over the argument's storage.

def to_tile_tensor[TensorType: Output & Tensor, //](tensor: TensorType) -> TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, MutUntrackedOrigin, Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]

Projects an output tensor argument to a mutable TileTensor view.

Deprecated: call tensor.to_tile_tensor(), the TileTensorable method, instead. Refine a Tensor-bound argument with conforms_to first.

Output tensors are writable by construction, so the trait bound selects the mutable projection without call sites passing mut=True.

Constraints:

TensorType must conform to TileTensorable.

Parameters:

  • ​TensorType (Output & Tensor): The output tensor-argument type (inferred).

Args:

  • ​tensor (TensorType): The output tensor argument to project.

Returns:

TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, MutUntrackedOrigin, Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]: A mutable TileTensor view over the argument's storage.

def to_tile_tensor[TensorType: MutableInput & Tensor, //](tensor: TensorType) -> TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, MutUntrackedOrigin, Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]

Projects a mutable-input tensor argument to a mutable TileTensor view.

Deprecated: call tensor.to_tile_tensor(), the TileTensorable method, instead. Refine a Tensor-bound argument with conforms_to first.

Mutable inputs are read-write by construction, so the trait bound selects the mutable projection without call sites passing mut=True.

Constraints:

TensorType must conform to TileTensorable.

Parameters:

  • ​TensorType (MutableInput & Tensor): The mutable-input tensor-argument type (inferred).

Args:

  • ​tensor (TensorType): The mutable-input tensor argument to project.

Returns:

TileTensor[TensorType.dtype, TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).LayoutType, MutUntrackedOrigin, Engine=TensorType if _require_tile_tensorable[TensorType]() else Never(TileTensorable).Engine]: A mutable TileTensor view over the argument's storage.

Was this page helpful?