DefaultTensorViewStrategy
Default implementation of TensorViewStrategy that prefers views when possible.
This strategy implements a conservative approach that favors zero-copy views for most operations while falling back to copying only in specific cases where views would be significantly inefficient.
Decision Logic
The strategy creates views when:
Slices are contiguous or have reasonable stride patterns
The parent tensor is not excessively large relative to the view
The slice doesn't result in highly scattered memory access
The strategy falls back to copying when:
Slices would result in very inefficient strided access patterns
Memory pressure is detected (not implemented in this basic version)
The view would be much smaller than the parent (preventing GC)
Inheritors
Properties
Maximum stride factor before preferring copy over view. If any dimension has a stride larger than this factor times the base dimension size, copying is preferred.
Threshold for view size relative to parent size. If the view is smaller than this fraction of the parent, copying might be preferred to allow parent GC.