Execute handlers on a subgraph to compute values. More...
#include <evaluator.hpp>
Data Structures | |
class | ExecuteInst |
All arguments have been handled; execute the node handler. More... | |
class | Inst |
Intstructions for evaluations state machine. More... | |
class | ValueInst |
Ensure value has been analyzed. More... | |
Public Types | |
using | value_map = std::map< RawNodeOutput, V > |
values we compute for outputs | |
using | op_handler = std::function< std::vector< V >(Node *op, std::vector< V > &inputs)> |
Handler for a computation of a value about an op. More... | |
using | op_handler_map = std::map< Node::type_info_t, op_handler > |
Table of ops with handlers. | |
Public Member Functions | |
Evaluator (const op_handler_map &handlers, value_map &values) | |
construct handler using the provided op handlers. More... | |
value_map & | get_value_map () |
Retrieves the value_map, which holds all Output<Node> value associations. | |
const value_map & | get_value_map () const |
const op_handler & | get_univeral_handler () const |
If set, handles all ops. | |
const op_handler & | get_default_handler () const |
If set, handles all ops not in the handlers. | |
void | set_univeral_handler (const op_handler &handler) |
If set, handles all ops. | |
void | set_default_handler (const op_handler &handler) |
If set, handles all ops not in the handlers. | |
V | evaluate (const Output< Node > &value) |
Determine information about value. | |
Protected Types | |
using | InstPtr = std::unique_ptr< Inst > |
using | InstStack = std::stack< InstPtr > |
Protected Member Functions | |
op_handler | get_handler (Node *node) |
Protected Attributes | |
op_handler | m_universal_handler |
op_handler_map | m_handlers |
op_handler | m_default_handler |
value_map & | m_value_map |
Execute handlers on a subgraph to compute values.
using ngraph::Evaluator< V >::op_handler = std::function<std::vector<V>(Node* op, std::vector<V>& inputs)> |
Handler for a computation of a value about an op.
A handler is passed a Node* and a vector of computed input values. The handler should return a vector of computed output values.
|
inline |
construct handler using the provided op handlers.
Evaluations share previously computed values so that calls on multiple nodes can share work. All state is kept in the value map, which is accessible for clearing or seeding with Evaluator::get_value_map().
Handlers | for ops. Pairs of Node::type_info_t and handler functions. |