ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::RealDivGraphBuilder Class Referencefinal

GraphBuilder for RealDiv node. More...

#include <RealDiv.h>

Collaboration diagram for moco::RealDivGraphBuilder:

Public Member Functions

bool validate (const tensorflow::NodeDef &) const override
 
void build (const tensorflow::NodeDef &, GraphBuilderContext *) const override
 
- Public Member Functions inherited from moco::GraphBuilder
virtual ~GraphBuilder ()
 

Detailed Description

GraphBuilder for RealDiv node.

Definition at line 28 of file RealDiv.h.

Member Function Documentation

◆ build()

void moco::RealDivGraphBuilder::build ( const tensorflow::NodeDef &  node,
GraphBuilderContext context 
) const
overridevirtual

Implements moco::GraphBuilder.

Definition at line 64 of file RealDiv.cpp.

65{
66 assert(context != nullptr);
67
68 loco::Graph *graph = context->graph();
69 SymbolTable *tensor_names = context->tensor_names();
70 UpdateQueue *updates = context->updates();
71
72 // creating TF dialect RealDiv node
73 auto tf_div = graph->nodes()->create<TFRealDiv>();
74 tf_div->name(node.name());
75
76 TensorName output_name(node.name(), 0);
77 tensor_names->enroll(output_name, tf_div);
78
79 std::vector<TensorName> div_input_names;
80 div_input_names.push_back(TensorName(node.input(0))); // x
81 div_input_names.push_back(TensorName(node.input(1))); // y
82
83 auto tf_div_update = std::make_unique<TFRealDivGraphUpdate>(tf_div, div_input_names);
84 updates->enroll(std::move(tf_div_update));
85}
A neural network graph.
Definition Graph.h:161
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 *.
Class to store GraphUpdate objects.
void enroll(std::unique_ptr< GraphUpdate > &&update)
Registers GraphUpdate objects.
NodeName name(void) const
Definition TFNodeDecl.h:50

References moco::SymbolTable::enroll(), moco::UpdateQueue::enroll(), moco::GraphBuilderContext::graph(), moco::TFNode::name(), moco::GraphBuilderContext::tensor_names(), and moco::GraphBuilderContext::updates().

◆ validate()

bool moco::RealDivGraphBuilder::validate ( const tensorflow::NodeDef &  node) const
overridevirtual

Implements moco::GraphBuilder.

Definition at line 59 of file RealDiv.cpp.

60{
61 return node.input_size() == 2;
62}

The documentation for this class was generated from the following files: