34class TFConcatV2GraphUpdate final :
public GraphUpdate
37 TFConcatV2GraphUpdate(
TFConcatV2 *node, std::vector<TensorName> names)
38 : _node(node), _names(names)
46 std::vector<TensorName> _names;
49void TFConcatV2GraphUpdate::input(
const SymbolTable *tensor_names)
const
51 uint32_t num_values = _names.size() - 1;
52 assert(num_values >= 1);
54 for (uint32_t i = 0; i < num_values; ++i)
57 assert(input_node !=
nullptr);
58 _node->values(i, input_node);
60 auto axis_node = tensor_names->
node(_names[num_values]);
61 assert(axis_node !=
nullptr);
62 _node->axis(axis_node);
76 const int num_inputs = node.input_size() - 1;
83 assert(context !=
nullptr);
85 auto graph = context->
graph();
87 auto updates = context->
updates();
89 const int num_inputs = node.input_size() - 1;
90 std::vector<TensorName> input_names;
91 auto concat_node = graph->nodes()->create<
TFConcatV2>(num_inputs);
92 concat_node->
name(node.name());
94 for (
int ni = 0; ni < num_inputs; ++ni)
96 input_names.push_back(
TensorName(node.input(ni)));
99 input_names.push_back(
TensorName(node.input(num_inputs)));
103 tensor_names->
enroll(output_name, concat_node);
105 auto update = std::make_unique<TFConcatV2GraphUpdate>(concat_node, input_names);
106 updates->enroll(std::move(
update));
bool validate(const tensorflow::NodeDef &) const final
void build(const tensorflow::NodeDef &, GraphBuilderContext *) const final
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...
CircleInput * input_node(loco::Graph *g, const loco::GraphInputIndex &index)
Find a Pull node with a given input index.
FeatureShapeUpdater update(loco::FeatureShape &feature_shape)
bool has_attrs(const tensorflow::NodeDef &node, const std::vector< std::string > &attr_names)
int64_t get_int_attr(const tensorflow::NodeDef &node, const std::string &attr_name)
NodeName name(void) const