|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Validated, non-owning view of tensor memory and its layout. More...
#include <TensorAccess.hpp>
Public Member Functions | |
| template<TensorElement T> | |
| std::span< const T > | as () const noexcept |
| Elements as a typed span. | |
| std::span< const std::byte > | bytes () const noexcept |
| Bytes of the elements when they are dense in C order. | |
| std::vector< DataDimension > | dimensions () const |
| Dimension descriptors with sizes and strides from the spec. | |
| uint64_t | element_count () const noexcept |
| Number of elements. | |
| const std::byte * | element_data () const noexcept |
| Pointer to element zero, or nullptr for an empty tensor. | |
| TensorGpuView | gpu_view () const noexcept |
| Upload description for a dense tensor. | |
| bool | read_only () const noexcept |
| Whether writers must treat the memory as immutable. | |
| const TensorSpec & | spec () const noexcept |
| Layout of the borrowed memory. | |
| std::span< const std::byte > | storage () const noexcept |
| The whole borrowed region. | |
Private Member Functions | |
| TensorAccess (std::span< const std::byte > storage, TensorSpec spec, bool read_only) | |
Private Attributes | |
| bool | m_read_only |
| TensorSpec | m_spec |
| std::span< const std::byte > | m_storage |
Friends | |
| MAYAFLUX_API std::optional< TensorAccess > | as_tensor_access (std::span< const std::byte > storage, const TensorSpec &spec, bool read_only=true) |
| Validate and borrow tensor memory. | |
Validated, non-owning view of tensor memory and its layout.
Works over any host memory: a TensorData, a DataVariant store, a mapped file or an imported DLPack tensor. Nothing is converted or copied.
Usage:
Definition at line 47 of file TensorAccess.hpp.