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

GraphBuilder for Maximum node. More...

#include <Maximum.h>

Collaboration diagram for moco::MaximumGraphBuilder:

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

Definition at line 28 of file Maximum.h.

Member Function Documentation

◆ build()

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

Implements moco::GraphBuilder.

Definition at line 65 of file Maximum.cpp.

66{
67 assert(context != nullptr);
68
69 loco::Graph *graph = context->graph();
70 SymbolTable *tensor_names = context->tensor_names();
71 UpdateQueue *updates = context->updates();
72
73 // creating TF dialect Maximum node
74 auto tf_maximum = graph->nodes()->create<TFMaximum>();
75 tf_maximum->name(node.name());
76
77 TensorName output_name(node.name(), 0);
78 tensor_names->enroll(output_name, tf_maximum);
79
80 std::vector<TensorName> add_input_names;
81 add_input_names.push_back(TensorName(node.input(0))); // x
82 add_input_names.push_back(TensorName(node.input(1))); // y
83
84 auto tf_maximum_update = std::make_unique<TFMaximumGraphUpdate>(tf_maximum, add_input_names);
85 updates->enroll(std::move(tf_maximum_update));
86}
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::MaximumGraphBuilder::validate ( const tensorflow::NodeDef &  node) const
overridevirtual

Implements moco::GraphBuilder.

Definition at line 60 of file Maximum.cpp.

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

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