33class TFMaximumGraphUpdate final :
public GraphUpdate
36 TFMaximumGraphUpdate(
TFMaximum *node, std::vector<TensorName> names) : _node(node), _names(names)
44 std::vector<TensorName> _names;
47void TFMaximumGraphUpdate::input(
const SymbolTable *tensor_names)
const
49 assert(_names.size() == 2);
51 _node->x(tensor_names->
node(_names[0]));
52 _node->y(tensor_names->
node(_names[1]));
62 return node.input_size() == 2;
67 assert(context !=
nullptr);
74 auto tf_maximum = graph->nodes()->create<
TFMaximum>();
75 tf_maximum->
name(node.name());
78 tensor_names->
enroll(output_name, tf_maximum);
80 std::vector<TensorName> add_input_names;
81 add_input_names.push_back(
TensorName(node.input(0)));
82 add_input_names.push_back(
TensorName(node.input(1)));
84 auto tf_maximum_update = std::make_unique<TFMaximumGraphUpdate>(tf_maximum, add_input_names);
85 updates->
enroll(std::move(tf_maximum_update));
Class to store context to build loco graph IR from TensorFlow.
SymbolTable * tensor_names()
Interface to connect the graph.
virtual void input(const SymbolTable *) const =0
Do the graph input connections using the SymbolTable.
void build(const tensorflow::NodeDef &, GraphBuilderContext *) const override
bool validate(const tensorflow::NodeDef &) const override
Class to store and query loco::Node* with string name key.
void enroll(const TensorName &tensor_name, loco::Node *node)
Registers a name with corresponding loco::Node *.
loco::Node * node(const TensorName &tensor_name) const
Queries enrolled(registered) with name and return node if found Will throw runtime_error if not found...
Class to store GraphUpdate objects.
void enroll(std::unique_ptr< GraphUpdate > &&update)
Registers GraphUpdate objects.
NodeName name(void) const