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

GraphBuilder for Tanh node. More...

#include <Tanh.h>

Collaboration diagram for moco::TanhGraphBuilder:

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

Definition at line 28 of file Tanh.h.

Member Function Documentation

◆ build()

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

Implements moco::GraphBuilder.

Definition at line 61 of file Tanh.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 Tanh node
70 auto tf_tanh = graph->nodes()->create<TFTanh>();
71 tf_tanh->name(node.name());
72
73 // register string-name to node
74 TensorName output_name(node.name(), 0);
75 tensor_names->enroll(output_name, tf_tanh);
76
77 // Queue node input update
78 auto tf_tanh_update = std::make_unique<TFTanhGraphUpdate>(tf_tanh, TensorName(node.input(0)));
79 updates->enroll(std::move(tf_tanh_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::TanhGraphBuilder::validate ( const tensorflow::NodeDef &  node) const
overridevirtual

Implements moco::GraphBuilder.

Definition at line 56 of file Tanh.cpp.

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

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