36 TFAddGraphUpdate(
TFAdd *node, std::vector<TensorName> names) : _node(node), _names(names) {}
42 std::vector<TensorName> _names;
45void TFAddGraphUpdate::input(
const SymbolTable *tensor_names)
const
47 assert(_names.size() == 2);
49 _node->x(tensor_names->
node(_names[0]));
50 _node->y(tensor_names->
node(_names[1]));
60 return node.input_size() == 2;
65 assert(context !=
nullptr);
72 auto tf_add = graph->nodes()->create<
TFAdd>();
73 tf_add->
name(node.name());
76 tensor_names->
enroll(output_name, tf_add);
78 std::vector<TensorName> add_input_names;
79 add_input_names.push_back(
TensorName(node.input(0)));
80 add_input_names.push_back(
TensorName(node.input(1)));
82 auto tf_add_update = std::make_unique<TFAddGraphUpdate>(tf_add, add_input_names);
83 updates->
enroll(std::move(tf_add_update));
void build(const tensorflow::NodeDef &, GraphBuilderContext *) const override
bool validate(const tensorflow::NodeDef &) const override
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.
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