|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Interpreter of a shape rule lowered to tables. More...
#include <rexlib/core/operation/shape_rule/shape_rule_interpreter.hpp>
Public Member Functions | |
| shape_rule_interpreter (const shape_rule_descriptor &rule) noexcept | |
| Construct an interpreter of a rule. | |
| void | check_instance (const operation_descriptor &descriptor, span< const std::size_t > named_axes, span< const std::size_t > operation_extents) const |
| Check the values an operation instance supplies. | |
| void | deduce (const operation_descriptor &descriptor, span< const std::size_t > named_axes, bool keep_dimensions, span< const std::size_t > operation_extents, span< operand_specification > canonical_outputs, span< const operand_specification > inputs) const |
| Compute the shapes of the outputs the inputs call for. | |
| void | accept (const operation_descriptor &descriptor, span< const std::size_t > named_axes, bool keep_dimensions, span< const std::size_t > operation_extents, span< const operand_specification > user_outputs, span< const operand_specification > inputs) const |
| Decide whether outputs supplied in advance have admissible shapes. | |
Interpreter of a shape rule lowered to tables.
Deduces the shapes of the outputs of an operation from the shapes of its inputs, and decides whether outputs supplied in advance have admissible shapes. Data types are left alone.
It knows nothing about operations or their parameters. Each call takes the values the rule reads from the operation instance:
|
explicitnoexcept |
Construct an interpreter of a rule.
| rule | The lowered rule. It must outlive the interpreter, which shape_rule_descriptor_of guarantees by holding it in static storage. |
| void rexlib::shape_rule_interpreter::accept | ( | const operation_descriptor & | descriptor, |
| span< const std::size_t > | named_axes, | ||
| bool | keep_dimensions, | ||
| span< const std::size_t > | operation_extents, | ||
| span< const operand_specification > | user_outputs, | ||
| span< const operand_specification > | inputs | ||
| ) | const |
Decide whether outputs supplied in advance have admissible shapes.
| descriptor | Description of the operation, used to name the operation and its operands when reporting a rejection. |
| named_axes | The named axes. |
| keep_dimensions | Whether an output with no core axes keeps the named axes. |
| operation_extents | The extents the operation supplies. |
| user_outputs | The outputs supplied in advance, one per output of the rule. |
| inputs | The inputs, one per input of the rule. |
| std::invalid_argument | When the inputs or an output are not admissible. |
| std::out_of_range | When a named axis is beyond the rank of the inputs. |
| void rexlib::shape_rule_interpreter::check_instance | ( | const operation_descriptor & | descriptor, |
| span< const std::size_t > | named_axes, | ||
| span< const std::size_t > | operation_extents | ||
| ) | const |
Check the values an operation instance supplies.
Checks what does not depend on the operands: how many axes are named and that none is named twice, and how many extents are supplied and that each lies in the domain of its variable.
| descriptor | Description of the operation, used to name it when reporting a rejection. |
| named_axes | The named axes. |
| operation_extents | The extents the operation supplies. |
| std::invalid_argument | When a value is not admissible. |
| void rexlib::shape_rule_interpreter::deduce | ( | const operation_descriptor & | descriptor, |
| span< const std::size_t > | named_axes, | ||
| bool | keep_dimensions, | ||
| span< const std::size_t > | operation_extents, | ||
| span< operand_specification > | canonical_outputs, | ||
| span< const operand_specification > | inputs | ||
| ) | const |
Compute the shapes of the outputs the inputs call for.
| descriptor | Description of the operation, used to name the operation and its operands when reporting a rejection. |
| named_axes | The named axes. |
| keep_dimensions | Whether an output with no core axes keeps the named axes. |
| operation_extents | The extents the operation supplies. |
| canonical_outputs | The outputs, one per output of the rule. Only their shapes are set. |
| inputs | The inputs, one per input of the rule. |
| std::invalid_argument | When the inputs are not admissible. |
| std::out_of_range | When a named axis is beyond the rank of the inputs. |