class ngraph::Evaluator¶
Overview¶
Execute handlers on a subgraph to compute values. More…
#include <evaluator.hpp>
template <>
class Evaluator
{
public:
// typedefs
typedef std::map<RawNodeOutput, V> value_map;
typedef std::function<std::vector<V>(Node \*op, std::vector<V>&inputs)> op_handler;
typedef std::map<Node::type_info_t, op_handler> op_handler_map;
// classes
class ExecuteInst;
class Inst;
class ValueInst;
// construction
Evaluator(, );
// methods
value_map& get_value_map();
const value_map& get_value_map() const;
const op_handler& get_univeral_handler() const;
const op_handler& get_default_handler() const;
voidconst op_handler& set_universal_handler();
voidconst op_handler& set_default_handler();
Vconst Output<Node>& evaluate();
};
Detailed Documentation¶
Execute handlers on a subgraph to compute values.
Typedefs¶
typedef std::map<RawNodeOutput, V> value_map
values we compute for outputs
typedef std::function<std::vector<V>(Node \*op, std::vector<V>&inputs)> op_handler
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.
typedef std::map<Node::type_info_t, op_handler> op_handler_map
Table of ops with handlers.
Construction¶
Evaluator(, )
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. |
Methods¶
value_map& get_value_map()
Retrieves the value_map, which holds all Output<Node> value associations.
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.
voidconst op_handler& set_universal_handler()
If set, handles all ops.
voidconst op_handler& set_default_handler()
If set, handles all ops not in the handlers.
Determine information about value.