MaterializationStrategy
Strategy interface for materializing tensor views into concrete tensors.
Materialization is the process of converting a tensor view (which references data from a parent tensor through coordinate transformations) into a standalone tensor with its own data storage. Different strategies provide different trade-offs between memory usage, computation time, and access patterns.
Strategy Patterns
Immediate Materialization: Creates a copy of the view data immediately
Lazy Materialization: Defers copying until the data is actually accessed
Reference Materialization: Maintains references while optimizing access
Batch Materialization: Optimizes for materializing multiple views together
Usage Context
Materialization strategies are particularly important for:
Performance optimization when views are accessed frequently
Memory management when parent tensors can be garbage collected
Computational efficiency when the view will be used in multiple operations
Interoperability when passing tensors between different computational backends
Parameters
the data type constraint extending DType
the actual value type that will be stored and accessed