39 TFPackGraphUpdate(
TFPack *node, std::vector<TensorName> names) : _node(node), _names(names) {}
45 std::vector<TensorName> _names;
48void TFPackGraphUpdate::input(
const SymbolTable *tensor_names)
const
50 uint32_t num_values = _names.size();
51 assert(num_values >= 1);
53 for (uint32_t i = 0; i < num_values; ++i)
56 assert(input_node !=
nullptr);
57 _node->values(i, input_node);
71 const int num_inputs = node.input_size();
77 assert(context !=
nullptr);
79 auto graph = context->
graph();
81 auto updates = context->
updates();
83 const int num_inputs = node.input_size();
84 std::vector<TensorName> input_names;
85 auto pack_node = graph->nodes()->create<
TFPack>(num_inputs);
86 pack_node->
name(node.name());
88 for (
int ni = 0; ni < num_inputs; ++ni)
90 input_names.push_back(
TensorName(node.input(ni)));
96 tensor_names->
enroll(output_name, pack_node);
98 auto update = std::make_unique<TFPackGraphUpdate>(pack_node, input_names);
99 updates->enroll(std::move(
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 final
void build(const tensorflow::NodeDef &, GraphBuilderContext *) const final
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