Overview
TensorRef is a template for objects pointing to the start of tensors of arbitrary rank and layout within memory. A TensorRef combines a pointer and a Layout concept to provide structured access to multi-dimensional data.
Header: cutlass/tensor_ref.h
Template Signature
Template Parameters
typename
Data type of element stored within tensor (concept: NumericType). Examples:
float, half_t, int8_ttypename
Defines a mapping from logical coordinate to linear memory (concept: Layout). Examples:
layout::RowMajor, layout::ColumnMajor, IdentityTensorLayout<2>Member Types
Constructors
Default Constructor
Pointer and Layout Constructor
ptr: Pointer to start of tensorlayout: Layout object containing stride and mapping function
Converting Constructor
Member Functions
const_ref
non_const_ref
reset
good
data
layout
stride
offset
at
operator[]
add_pointer_offset
add_coord_offset
Arithmetic Operators
Helper Functions
make_TensorRef
TensorRef_aligned
Usage Examples
Frominclude/cutlass/tensor_ref.h:120-144:
Column-major matrix
Row-major matrix
Interleaved matrix
Contiguous matrix with runtime layout
Accessing elements
See Also
- Layout Types - Layout functions for various matrix formats
- Gemm - GEMM operator that uses TensorRef for matrix operands
- Array - Statically-sized array container