36 ReshapeGraphUpdate(
TFReshape *node, std::vector<TensorName> names) : _node(node), _names(names) {}
42 std::vector<TensorName> _names;
45void ReshapeGraphUpdate::input(
const SymbolTable *node_table)
const
47 assert(_names.size() == 2);
49 auto tensor_node = node_table->
node(_names[0]);
50 auto shape_node = node_table->
node(_names[1]);
52 assert(tensor_node !=
nullptr);
53 assert(shape_node !=
nullptr);
55 _node->tensor(tensor_node);
56 _node->shape(shape_node);
67 if (node.input_size() != 2)
76 assert(context !=
nullptr);
83 std::string reshape_name = node.name();
85 auto reshape = graph->nodes()->create<
TFReshape>();
86 reshape->name(node.name());
90 tensor_names->
enroll(output_name, reshape);
92 std::vector<TensorName> input_names;
93 input_names.push_back(
TensorName(node.input(0)));
94 input_names.push_back(
TensorName(node.input(1)));
97 auto update = std::make_unique<ReshapeGraphUpdate>(reshape, input_names);
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.
FeatureShapeUpdater update(loco::FeatureShape &feature_shape)
bool has_attrs(const tensorflow::NodeDef &node, const std::vector< std::string > &attr_names)