TensorStorage
Runtime descriptor for a tensor's backing memory.
TensorStorage is the main architectural type that replaces ad-hoc array passing between loaders, planners, and backends. It carries enough information to handle a tensor without inspecting its bytes:
What the values mean: logicalType
How they are stored: encoding
Layout: shape, byteOffset, strides, isContiguous
Ownership: via buffer's BufferHandle subtype
Existing sk.ainet.lang.tensor.data.TensorData remains as a compatibility façade. New loaders, planners, and backends should target TensorStorage directly.
Constructors
Properties
Number of logical elements in this tensor.
Whether this storage is backed by a memory-mapped file.
Logical size: number of elements x logical element size.
Physical size: actual bytes consumed in the buffer for this tensor.
Functions
Create a new TensorStorage with an owned copy of this storage's data. The returned storage is independent of the original buffer.
Request a copy of this storage on the specified device. Currently only CPU is supported — GPU/NPU backends will override.
Ensure this storage resides on the host (CPU heap). If already on host, returns this. Otherwise copies to host.
Memory report for this single tensor, useful for diagnostics and regression testing.
Re-encode this storage into a different physical encoding. Currently a stub — actual transcoding requires backend kernels.