37 TFPadGraphUpdate(
TFPad *node, std::vector<TensorName> names) : _node(node), _names(names) {}
43 std::vector<TensorName> _names;
46void TFPadGraphUpdate::input(
const SymbolTable *table)
const
48 assert(_names.size() == 2);
50 _node->input(table->
node(_names[0]));
51 _node->paddings(table->
node(_names[1]));
61 if (node.input_size() != 2)
69 assert(context !=
nullptr);
76 auto tf_pad = graph->nodes()->create<
TFPad>();
77 tf_pad->
name(node.name());
81 tensor_names->
enroll(output_name, tf_pad);
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)));
88 auto tf_pad_update = std::make_unique<TFPadGraphUpdate>(tf_pad, add_input_names);
89 updates->
enroll(std::move(tf_pad_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.
bool has_attrs(const tensorflow::NodeDef &node, const std::vector< std::string > &attr_names)
NodeName name(void) const