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

◆ from_values()

template<TensorElement T>
std::optional< TensorData > MayaFlux::Kakshya::TensorData::from_values ( std::span< const T > values,
std::vector< uint64_t > shape = {},
std::string name = {} )
inlinestaticnodiscard

Contiguous tensor holding a copy of typed values.

Parameters
valuesElements in C order.
shapeDimension sizes; empty means one dimension of values.size().
nameOptional tensor name.
Returns
Tensor, or std::nullopt when the shape does not match the count.

Definition at line 75 of file Tensor.hpp.

76 {}, std::string name = {})
77 {
78 if (shape.empty())
79 shape.push_back(values.size());
80 return from_bytes(
81 TensorSpec::contiguous(TensorDType::of<T>(), std::move(shape), std::move(name)),
82 std::as_bytes(values));
83 }
static std::optional< TensorData > from_bytes(TensorSpec spec, std::span< const std::byte > bytes)
Tensor holding a copy of bytes.
Definition Tensor.cpp:93
static constexpr TensorDType of() noexcept
Type for a C++ scalar or complex element.
static TensorSpec contiguous(TensorDType dtype, std::vector< uint64_t > shape, std::string name={})
C-ordered spec with no offset, axes or quantization.

References from_values(), and TensorData().

Referenced by MayaFlux::Yantra::PhonemeAnalysis::as_tensor(), from_values(), from_variant(), and MayaFlux::Yantra::LagProfile::to_tensor().

Here is the call graph for this function:
Here is the caller graph for this function: