Data Structures | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
ngraph::Evaluator< V > Class Template Reference

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_mapget_value_map ()
 Retrieves the value_map, which holds all Output<Node> value associations.
 
const value_mapget_value_map () const
 
const op_handlerget_univeral_handler () const
 If set, handles all ops.
 
const op_handlerget_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.
 
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_mapm_value_map
 

Detailed Description

template<typename V>
class ngraph::Evaluator< V >

Execute handlers on a subgraph to compute values.

Member Typedef Documentation

◆ op_handler

template<typename V >
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.

Constructor & Destructor Documentation

◆ Evaluator()

template<typename V >
ngraph::Evaluator< V >::Evaluator ( const op_handler_map handlers,
value_map 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().

Parameters
Handlersfor ops. Pairs of Node::type_info_t and handler functions.

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