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

GraphBuilder for Sqrt node. More...

#include <Sqrt.h>

Collaboration diagram for moco::SqrtGraphBuilder:

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 Sqrt node.

Definition at line 28 of file Sqrt.h.

Member Function Documentation

◆ build()

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

Implements moco::GraphBuilder.

Definition at line 61 of file Sqrt.cpp.

62{
63 assert(context != nullptr);
64
65 loco::Graph *graph = context->graph();
66 SymbolTable *tensor_names = context->tensor_names();
67 UpdateQueue *updates = context->updates();
68
69 // creating TF dialect Sqrt node
70 auto tf_sqrt = graph->nodes()->create<TFSqrt>();
71 tf_sqrt->name(node.name());
72
73 // register string-name to node
74 TensorName output_name(node.name(), 0);
75 tensor_names->enroll(output_name, tf_sqrt);
76
77 // Queue node input update
78 auto tf_sqrt_update = std::make_unique<TFSqrtGraphUpdate>(tf_sqrt, TensorName(node.input(0)));
79 updates->enroll(std::move(tf_sqrt_update));
80}
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::SqrtGraphBuilder::validate ( const tensorflow::NodeDef &  node) const
overridevirtual

Implements moco::GraphBuilder.

Definition at line 56 of file Sqrt.cpp.

57{
58 return node.input_size() == 1;
59}

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