38 : _node(node), _input_name(input_name), _reduction_indices_name(reduction_indices_name)
51void MeanGraphUpdate::input(
const SymbolTable *table)
const
54 loco::Node *reduction_indices_node = table->
node(_reduction_indices_name);
55 _node->input(input_node);
56 _node->reduction_indices(reduction_indices_node);
66 if (node.input_size() != 2)
73 if (dtype != tensorflow::DataType::DT_INT32 && dtype != tensorflow::DataType::DT_INT64)
81 assert(context !=
nullptr);
88 auto tf_mean = graph->nodes()->create<
TFMean>();
89 tf_mean->
name(node.name());
93 tensor_names->
enroll(output_name, tf_mean);
95 auto update = std::make_unique<MeanGraphUpdate>(tf_mean,
TensorName(node.input(0)),
Logical unit of computation.
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.
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)
bool get_bool_attr(const tensorflow::NodeDef &node, const std::string &attr_name)
tensorflow::DataType get_datatype_attr(const tensorflow::NodeDef &node, const std::string &attr_name)
NodeName name(void) const