21{
22 if (!input.data) {
24 std::source_location::current(), "TensorConverter: the input holds no tensor container");
25 }
26
27 const auto view = input.data->view();
28 if (!view) {
30 std::source_location::current(), "TensorConverter: the tensor container holds no valid tensor");
31 }
32
35 if (!converted) {
37 std::source_location::current(), "TensorConverter: {}", converted.error());
38 }
39
40 output_type output(std::make_shared<Kakshya::TensorContainer>(std::move(*converted)));
41 output.metadata = input.metadata;
42 output.facets = input.facets;
43 return output;
44}
const Config & config() const
Datum< InputType > output_type
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP).
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
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.