TensorView
A tensor view interface that represents a zero-copy slice or subset of a parent tensor.
TensorView extends the base Tensor interface while adding view-specific functionality for efficient tensor slicing operations. Views provide memory-efficient access to portions of larger tensors without copying the underlying data.
Key Characteristics
Zero-Copy: Views reference the parent tensor's data without duplication
Shape Transformation: Views can have different shapes than their parent
Index Mapping: Coordinate transformation between view space and parent space
Memory Efficiency: Multiple views can reference the same underlying data
Usage Patterns
Views are particularly useful for:
Batch processing (extracting mini-batches from larger datasets)
Channel extraction (accessing specific feature maps in NCHW tensors)
Spatial regions (selecting rectangular areas in image tensors)
Sequence windows (sliding window operations on temporal data)
Parameters
the data type constraint extending DType, defining the numerical precision
the actual value type that will be stored and accessed
Inheritors
Properties
Functions
Provides a more detailed contiguity analysis with diagnostic information.
Checks if this tensor view can be materialized using the default strategy.
Checks if this tensor view can be materialized using a specific strategy.
Estimates the memory overhead of materializing this tensor view.
Estimates the memory overhead of materializing this tensor view with a specific strategy.
Determines if this tensor view represents a contiguous memory layout.
Materializes this tensor view into a standalone tensor using the default strategy.
Materializes this tensor view using a specific materialization strategy.
Creates a view of an existing tensor view, enabling view chaining.