33class TFSquaredDifferenceGraphUpdate final :
public GraphUpdate
37 : _node(node), _names(names)
45 std::vector<TensorName> _names;
48void TFSquaredDifferenceGraphUpdate::input(
const SymbolTable *table)
const
50 assert(_names.size() == 2);
52 _node->x(table->
node(_names[0]));
53 _node->y(table->
node(_names[1]));
63 return node.input_size() == 2;
69 assert(context !=
nullptr);
77 tf_sqdiff->
name(node.name());
81 tensor_names->
enroll(output_name, tf_sqdiff);
83 std::vector<TensorName> add_input_names;
84 add_input_names.push_back(
TensorName(node.input(0)));
85 add_input_names.push_back(
TensorName(node.input(1)));
89 std::make_unique<TFSquaredDifferenceGraphUpdate>(tf_sqdiff, add_input_names);
90 updates->
enroll(std::move(tf_sqrt_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.
bool validate(const tensorflow::NodeDef &) const override
void build(const tensorflow::NodeDef &, GraphBuilderContext *) 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