Overview
cute::Tensor is CuTe’s core data structure that combines an Engine (data storage) with a Layout (coordinate-to-index mapping). Tensors can be owning (allocating their own storage) or non-owning (viewing existing memory).
Class Template
Template Parameters
Engine
The data storage engine. Can be:
ViewEngine<T*>for non-owning viewsArrayEngine<T, N>for owning static arraysConstViewEngine<const T*>for const views
Layout<Shape, Stride>
The layout describing the coordinate-to-index mapping.
Source Location
include/cute/tensor_impl.hpp:135-341
Member Functions
Data Access
data()
layout()
shape()
stride()
size()
Indexing
operator[]
operator()
coord contains _ (underscore), returns a sliced subtensor. Otherwise, returns a reference to the element.
Example:
Transformation
compose()
tile()
Coordinate Conversion
get_1d_coord()
get_hier_coord()
get_flat_coord()
Factory Functions
make_tensor() - Owning
T: Element typeargs: Layout arguments (shape, stride, or Layout)
make_tensor() - Non-owning
iter: Pointer or iterator to the dataargs: Layout arguments
make_tensor_like()
make_fragment_like()
make_identity_tensor()
Engine Types
ViewEngine
Non-owning view of existing memory:ArrayEngine
Owning static array (compile-time size):Common Operations
Tensor Partitioning
Tensor Slicing
Tensor Reshaping
Usage Examples
Basic Tensor Creation and Access
Register Tensors (Fragments)
Tiled Tensor Processing
Hierarchical Tensor Layouts
See Also
- cute::Layout - Layout type for coordinate mapping
- cute::TiledMma - Tiled matrix multiply
- cute::TiledCopy - Tiled copy operations