SlicedTensorView
A concrete implementation of TensorView that provides zero-copy sliced access to parent tensors.
SlicedTensorView creates a view of a parent tensor by applying a list of slice operations, one for each dimension. The view appears as a regular tensor but delegates all data access through coordinate transformation to the parent tensor's storage.
Key Features
Zero-Copy Operations: No data duplication, only metadata storage
Lazy Evaluation: Shape and index mapping computed on construction
Efficient Access: Optimized coordinate transformation for common patterns
Type Safety: Maintains type constraints from parent tensor
Memory Layout Considerations
The view maintains minimal memory overhead:
Reference to parent tensor
Computed view shape
Index mapper instance
Slice list (for potential reuse/optimization)
Performance Characteristics
Access performance depends on slice patterns:
Contiguous slices: Near-native performance
Strided slices: Moderate overhead from coordinate calculation
Complex patterns: Higher overhead but still zero-copy
Parameters
the data type constraint extending DType
the actual value type
the parent tensor to create a view of
list of slice operations, one per dimension
Constructors
Properties
Delegate data access to a wrapper that handles coordinate transformation.
The index mapper for coordinate transformation between view and parent space.
The slice operations applied to create this view.