Class ngraph::Evaluator¶
-
template<typename V>
class Evaluator¶ Execute handlers on a subgraph to compute values.
Public Types
-
using 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.
-
using op_handler_map = std::map<Node::type_info_t, op_handler>¶
Table of ops with handlers.
Public Functions
-
inline Evaluator(const op_handler_map &handlers, value_map &values)¶
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
Handlers – for ops. Pairs of Node::type_info_t and handler functions.
-
inline value_map &get_value_map()¶
Retrieves the value_map, which holds all Output<Node> value associations.
-
inline const op_handler &get_univeral_handler() const¶
If set, handles all ops.
-
inline const op_handler &get_default_handler() const¶
If set, handles all ops not in the handlers.
-
inline void set_universal_handler(const op_handler &handler)¶
If set, handles all ops.
-
inline void set_default_handler(const op_handler &handler)¶
If set, handles all ops not in the handlers.
-
using op_handler = std::function<std::vector<V>(Node *op, std::vector<V> &inputs)>¶