TensorStorageCache
TensorStorageCache
Cache structure for fast-path access to tensor storage. More…
#include <TensorStorageBase.hpp>
Public Functions
| Name | |
|---|---|
| bool | isValid() const Check if cache is usable for fast-path access. |
Public Attributes
| Name | |
|---|---|
| float const * | data_ptr Raw pointer to contiguous float data. |
| std::size_t | total_elements Total number of elements. |
| std::vector< std::size_t > | shape Shape of the tensor. |
| std::vector< std::size_t > | strides Row-major strides (elements, not bytes). |
| bool | is_valid True if contiguous and data_ptr is usable. |
Detailed Description
struct TensorStorageCache;Cache structure for fast-path access to tensor storage.
Provides raw pointers and stride information for consumers that can exploit contiguous layout (plotting, bulk export, Armadillo/LibTorch interop). Follows the same cache pattern as RaggedAnalogStorageCache and AnalogTimeSeries’ storage cache.
Usage:
auto cache = storage.tryGetCache();
if (cache.isValid()) {
// Fast path: direct pointer access with strides
for (size_t i = 0; i < cache.total_elements; ++i) {
float val = cache.data_ptr[i];
}
} else {
// Slow path: element-by-element via virtual dispatch
}Public Functions Documentation
function isValid
inline bool isValid() constCheck if cache is usable for fast-path access.
Public Attributes Documentation
variable data_ptr
float const * data_ptr = nullptr;Raw pointer to contiguous float data.
variable total_elements
std::size_t total_elements = 0;Total number of elements.
variable shape
std::vector< std::size_t > shape;Shape of the tensor.
variable strides
std::vector< std::size_t > strides;Row-major strides (elements, not bytes).
variable is_valid
bool is_valid = false;True if contiguous and data_ptr is usable.
Updated on 2026-11-13 at 20:25:39 +0000