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

◆ to_variant()

std::optional< DataVariant > MayaFlux::Kakshya::TensorData::to_variant ( ) const
nodiscard

Copy into a flat DataVariant when the dtype has an alternative.

Returns
Variant for f64, f32, u8, u16, u32, complex f32 and complex f64 dense tensors, otherwise std::nullopt.

Definition at line 157 of file Tensor.cpp.

158{
159 if (const auto v = to_vector<double>())
160 return DataVariant { *v };
161 if (const auto v = to_vector<float>())
162 return DataVariant { *v };
163 if (const auto v = to_vector<uint8_t>())
164 return DataVariant { *v };
165 if (const auto v = to_vector<uint16_t>())
166 return DataVariant { *v };
167 if (const auto v = to_vector<uint32_t>())
168 return DataVariant { *v };
169 if (const auto v = to_vector<std::complex<float>>())
170 return DataVariant { *v };
171 if (const auto v = to_vector<std::complex<double>>())
172 return DataVariant { *v };
173 return std::nullopt;
174}
std::optional< std::vector< T > > to_vector() const
Copy into a vector of T.
Definition Tensor.hpp:132
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
Definition NDData.hpp:58

References to_vector().

Here is the call graph for this function: