12 const auto view = input.data->view();
24 std::source_location::current(),
"TensorConverter: the input holds no tensor container");
27 const auto view = input.
data->view();
30 std::source_location::current(),
"TensorConverter: the tensor container holds no valid tensor");
37 std::source_location::current(),
"TensorConverter: {}", converted.error());
40 output_type output(std::make_shared<Kakshya::TensorContainer>(std::move(*converted)));
42 output.
facets = input.facets;
const Config & config() const
Datum< InputType > output_type
Datum< InputType > input_type
bool validate_input(const input_type &input) const override
True when the input holds a valid tensor the configured conversion accepts.
output_type operation_function(const input_type &input) override
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
std::string diagnose_conversion(const TensorSpec &source, TensorDType target, const std::optional< TensorQuantization > &quantization)
Empty when a tensor can be converted to a type, otherwise the reason it cannot.
std::expected< TensorData, std::string > convert_tensor(const TensorAccess &source, TensorDType target, const std::optional< TensorQuantization > &quantization)
Convert the elements of a tensor to another element type.
T data
The actual computation data.
Facets facets
Typed results that travel with the data, read by type.
std::unordered_map< std::string, std::any > metadata
Associated metadata.