MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ write_bytes()

bool MayaFlux::Kakshya::TensorInsertion::write_bytes ( std::span< const std::byte > bytes,
uint64_t byte_offset = 0 )

Write raw bytes into the elements of a dense tensor.

Parameters
bytesBytes to write.
byte_offsetOffset from element zero.
Returns
False for a strided layout or a range past the end.

Definition at line 29 of file TensorInsertion.cpp.

30{
31 const auto& spec = m_tensor->m_spec;
32 const auto count = spec.element_count();
33 if (!count || !spec.is_contiguous() || !m_tensor->is_valid())
34 return false;
35
36 const auto total = spec.dtype.storage_bytes(*count);
37 if (!total || byte_offset > *total || bytes.size() > *total - byte_offset)
38 return false;
39
40 if (!bytes.empty())
41 std::memcpy(m_tensor->m_data.get() + spec.byte_offset + byte_offset, bytes.data(), bytes.size());
42 return true;
43}
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506

References m_tensor.

Referenced by assign(), and write().

Here is the caller graph for this function: