MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::TensorConverter Class Referencefinal

Converts the element type of a tensor, reading and writing quantization. More...

#include <TensorConverter.hpp>

Inheritance diagram for MayaFlux::Yantra::TensorConverter:
Collaboration diagram for MayaFlux::Yantra::TensorConverter:

Public Types

using supports = Supports<TensorConversionConfig>
Public Types inherited from MayaFlux::Yantra::ComputeOperation< std::shared_ptr< Kakshya::TensorContainer > >
using input_type
using output_type

Public Member Functions

ConfigRefs configs () const override
 The stored settings, or none when defaults are in use.
std::string get_name () const override
 Get operation name for debugging/introspection.
OperationType get_operation_type () const override
 Returns the category of this operation for grammar and registry discovery.
bool validate_input (const input_type &input) const override
 True when the input holds a valid tensor the configured conversion accepts.
Public Member Functions inherited from MayaFlux::Yantra::ComputeOperation< std::shared_ptr< Kakshya::TensorContainer > >
void add_dependency (std::shared_ptr< ComputeOperation > dep)
output_type apply_operation (const input_type &input)
 Public synchronous execution interface.
output_type apply_operation_with_dependencies (const input_type &input)
 Applies the operation with dependencies resolved.
InputType apply_to_data (const InputType &data)
 Convenience overload that extracts just the data from result.
 ComputeOperation ()
 Constructor with data type validation warnings.
const Config & config () const
 The stored config struct of type Config, or its defaults when none was set.
output_type execute (const input_type &input)
 OpUnit interface - operations can act as units in dependency graphs.
const auto & get_dependencies () const
const ExecutionContext & get_last_execution_context () const
void merge_config (const Facets &incoming)
 Adds the config structs of incoming, replacing stored ones of the same type.
output_type operator() (const InputType &data)
 Convenience overload for direct data processing (backward compatibility).
const Config * resolved_config () const
 The stored config struct of type Config, or nullptr when absent.
void set_config (Config config)
 Stores a config struct, whole, under its own type.
void set_last_execution_context (const ExecutionContext &ctx)
void set_post_execution_hook (const OperationHookCallback &hook)
void set_pre_execution_hook (const OperationHookCallback &hook)
void set_reconstruction_callback (const ReconstructionCallback &callback)
ConfigRefs stored_configs (Supports< Configs... >) const
 The stored configs among those listed, in listed order.
virtual bool validate_input (const input_type &) const
 Validates if the input data meets the operation's requirements.
virtual ~ComputeOperation ()=default
 Virtual destructor for proper cleanup of derived classes.

Protected Member Functions

output_type operation_function (const input_type &input) override
Protected Member Functions inherited from MayaFlux::Yantra::ComputeOperation< std::shared_ptr< Kakshya::TensorContainer > >
output_type apply_hooks (const input_type &input, const ExecutionContext &context)
virtual std::future< output_type > apply_operation_async (const input_type &input)
 Optional async implementation - default delegates to operation_function.
virtual output_type apply_operation_chained (const input_type &input, const ExecutionContext &ctx)
 Optional chain-aware implementation - default delegates to operation_function.
virtual output_type apply_operation_internal (const input_type &input, const ExecutionContext &context)
 Internal execution method - ComputeMatrix can access this.
virtual output_type apply_operation_parallel (const input_type &input, const ExecutionContext &ctx)
 Optional parallel-aware implementation - default delegates to operation_function.
output_type convert_result (std::vector< std::vector< double > > &result_data, DataStructureInfo &metadata)
 Convert processed double data back to OutputType using metadata and optional callback.
virtual output_type operation_function (const input_type &input)=0
 Executes the computational transformation on the input data.

Additional Inherited Members

Protected Attributes inherited from MayaFlux::Yantra::ComputeOperation< std::shared_ptr< Kakshya::TensorContainer > >
ExecutionContext m_last_execution_context

Detailed Description

Converts the element type of a tensor, reading and writing quantization.

Takes a tensor container and produces a new one with the target element type, the source's name and axes, and dense C-order storage. A source that carries quantization is dequantized; a configured quantization is applied to the result. The input container is not modified. Facets and metadata of the input travel with the output.

Supported element types are whole-byte integers, bool, half, bfloat16, float, double and complex of float and double. Everything else, and any combination convert_tensor refuses, is reported by validate_input and thrown by the operation with the reason.

Usage:

auto convert = std::make_shared<TensorConverter>();
convert->set_config(config);
auto result = convert->apply_operation(TensorContainerIO { weights });
Datum< std::shared_ptr< Kakshya::TensorContainer > > TensorContainerIO
IO for Tensor containers.
Definition DataIO.hpp:474
static constexpr TensorDType of() noexcept
Type for a C++ scalar or complex element.
Settings of TensorConverter, stored whole in the operation's facets.

Definition at line 45 of file TensorConverter.hpp.


The documentation for this class was generated from the following files: