MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kakshya::TensorInsertion Class Reference

Mutable adapter for writing into a TensorData. More...

#include <TensorInsertion.hpp>

Collaboration diagram for MayaFlux::Kakshya::TensorInsertion:

Public Member Functions

bool assign (const TensorAccess &view)
 Overwrite the tensor with a copy of a view of the same dtype and shape.
bool assign_window (const Region &region, const TensorAccess &view)
 Overwrite the box a Region selects with a view of the box's shape.
bool reshape (std::vector< uint64_t > shape)
 Change the shape without moving data.
bool resize (std::vector< uint64_t > shape)
 Replace the shape and reallocate.
bool set_axes (std::vector< DataDimension > axes)
 Attach per-axis roles and names; the count must equal the rank.
void set_name (std::string name)
 Rename the tensor.
bool set_quantization (std::optional< TensorQuantization > quantization)
 Attach or clear quantization; it must be consistent with the shape.
 TensorInsertion (TensorData &tensor) noexcept
 Borrow the tensor to write into.
template<TensorElement T>
bool write (std::span< const T > values, uint64_t first_element=0)
 Write typed values into a dense tensor.
bool write_bytes (std::span< const std::byte > bytes, uint64_t byte_offset=0)
 Write raw bytes into the elements of a dense tensor.

Private Attributes

TensorData * m_tensor

Detailed Description

Mutable adapter for writing into a TensorData.

Writes typed values or raw bytes, copies a whole view into the tensor, reshapes, resizes, and attaches axes or quantization. Every call validates against the tensor's spec and returns false, leaving the tensor unchanged, on a mismatch.

Usage:

TensorInsertion insert(weights);
insert.write<float>(values, 0);
insert.reshape({ 64, 3, 7, 7 });
TensorInsertion(TensorData &tensor) noexcept
Borrow the tensor to write into.
Note
The destination must outlive the adapter.

Definition at line 27 of file TensorInsertion.hpp.


The documentation for this class was generated from the following files: