ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::onnx::Identity_V1 Class Reference

GraphBuilder for Identity(since version 1) node. More...

#include <Identity.h>

Public Member Functions

bool validate (const ::onnx::NodeProto &) const
 
void build (const ::onnx::NodeProto &, GraphBuilderContext *) const
 

Detailed Description

GraphBuilder for Identity(since version 1) node.

Definition at line 29 of file Identity.h.

Member Function Documentation

◆ build()

void moco::onnx::Identity_V1::build ( const ::onnx::NodeProto &  node,
GraphBuilderContext context 
) const

Definition at line 28 of file Identity_V1.cpp.

29{
30 assert(context != nullptr);
31
32 loco::Graph *graph = context->graph();
33 SymbolTable *nodes = context->nodes();
34 SymbolTable *input_names = context->input_names();
35
36 // Create a "Forward" node for Identity
37 auto forward_node = graph->nodes()->create<loco::Forward>();
38
39 nodes->enroll(node.name(), forward_node);
40 nodes->enroll(node.output(0), forward_node);
41
42 // Record all inputs to forward_node
43 for (int i = 0; i < node.input_size(); ++i)
44 {
45 const auto &input_name = node.input(i);
46 input_names->list(forward_node, input_name);
47 }
48}
Create a new value identical to its input.
Definition Nodes.h:146
Node * input(void) const
Definition Nodes.h:151
A neural network graph.
Definition Graph.h:161

References moco::onnx::SymbolTable::enroll(), moco::onnx::GraphBuilderContext::graph(), moco::onnx::GraphBuilderContext::input_names(), moco::onnx::SymbolTable::list(), and moco::onnx::GraphBuilderContext::nodes().

Referenced by moco::onnx::IdentityGraphBuilder::build().

◆ validate()

bool moco::onnx::Identity_V1::validate ( const ::onnx::NodeProto &  ) const

Definition at line 26 of file Identity_V1.cpp.

26{ return true; }

Referenced by moco::onnx::IdentityGraphBuilder::validate().


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