Execute operations with grammar rule pre-processing.
- Template Parameters
-
| InputType | The input data type |
- Parameters
-
| input | Input data to process |
| context | Execution context containing parameters and metadata |
- Returns
- Processed input data after grammar rule application
Applies grammar rules to the input data before any matrix operations. This allows for intelligent preprocessing, operation selection, and parameter configuration based on the input characteristics and context.
The process:
- Wraps input data in IO structure
- Searches for matching grammar rules
- Applies the best matching rule if found
- Returns processed data or original data if no rules match
- Note
- This method focuses on grammar rule application. Use the base ComputeMatrix methods for actual operation execution.
Definition at line 475 of file ComputePipeline.hpp.
475 {})
476 {
477 IO<InputType> input_data { input };
478
479 if (
auto best_rule =
m_grammar->find_best_match(input_data, context)) {
480 if (
auto rule_result =
m_grammar->execute_rule(best_rule->name, input_data, context)) {
481 try {
482 input_data = std::any_cast<IO<InputType>>(*rule_result);
483 } catch (const std::bad_any_cast&) {
484
485 }
486 }
487 }
488
489 return input_data;
490 }
std::shared_ptr< ComputationGrammar > m_grammar
Grammar instance for rule-based operation selection.