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

Class to return graph builder for TF nodes. More...

#include <GraphBuilderRegistry.h>

Collaboration diagram for moco::GraphBuilderRegistry:

Public Member Functions

 GraphBuilderRegistry ()
 
 GraphBuilderRegistry (const GraphBuilderSource *parent)
 
const GraphBuilderlookup (const std::string &op) const final
 Returns registered GraphBuilder pointer for operator or nullptr if not registered.
 
void add (const std::string op, std::unique_ptr< GraphBuilder > &&builder)
 
- Public Member Functions inherited from moco::GraphBuilderSource
virtual ~GraphBuilderSource ()=default
 

Static Public Member Functions

static GraphBuilderRegistryget ()
 

Detailed Description

Class to return graph builder for TF nodes.

Definition at line 42 of file GraphBuilderRegistry.h.

Constructor & Destructor Documentation

◆ GraphBuilderRegistry() [1/2]

moco::GraphBuilderRegistry::GraphBuilderRegistry ( )

Definition at line 25 of file GraphBuilderRegistry.cpp.

26{
27 add("Add", std::make_unique<AddGraphBuilder>());
28 add("AvgPool", std::make_unique<AvgPoolGraphBuilder>());
29 add("BiasAdd", std::make_unique<BiasAddGraphBuilder>());
30 add("ConcatV2", std::make_unique<ConcatV2GraphBuilder>());
31 add("Const", std::make_unique<ConstGraphBuilder>());
32 add("Conv2D", std::make_unique<Conv2DGraphBuilder>());
33 add("Conv2DBackpropInput", std::make_unique<Conv2DBackpropInputGraphBuilder>());
34 add("DepthwiseConv2dNative", std::make_unique<DepthwiseConv2dNativeGraphBuilder>());
35 add("FakeQuantWithMinMaxVars", std::make_unique<FakeQuantWithMinMaxVarsGraphBuilder>());
36 add("FusedBatchNorm", std::make_unique<FusedBatchNormGraphBuilder>());
37 add("Identity", std::make_unique<IdentityGraphBuilder>());
38 add("Maximum", std::make_unique<MaximumGraphBuilder>());
39 add("MaxPool", std::make_unique<MaxPoolGraphBuilder>());
40 add("Mean", std::make_unique<MeanGraphBuilder>());
41 add("Mul", std::make_unique<MulGraphBuilder>());
42 add("Pack", std::make_unique<PackGraphBuilder>());
43 add("Pad", std::make_unique<PadGraphBuilder>());
44 add("Placeholder", std::make_unique<PlaceholderGraphBuilder>());
45 add("RealDiv", std::make_unique<RealDivGraphBuilder>());
46 add("Relu", std::make_unique<ReluGraphBuilder>());
47 add("Relu6", std::make_unique<Relu6GraphBuilder>());
48 add("Reshape", std::make_unique<ReshapeGraphBuilder>());
49 add("Rsqrt", std::make_unique<RsqrtGraphBuilder>());
50 add("Shape", std::make_unique<ShapeGraphBuilder>());
51 add("Softmax", std::make_unique<SoftmaxGraphBuilder>());
52 add("Sqrt", std::make_unique<SqrtGraphBuilder>());
53 add("SquaredDifference", std::make_unique<SquaredDifferenceGraphBuilder>());
54 add("Squeeze", std::make_unique<SqueezeGraphBuilder>());
55 add("StopGradient", std::make_unique<StopGradientGraphBuilder>());
56 add("StridedSlice", std::make_unique<StridedSliceGraphBuilder>());
57 add("Sub", std::make_unique<SubGraphBuilder>());
58 add("Tanh", std::make_unique<TanhGraphBuilder>());
59
60 // Virtual node like `TFPush` need not to be added here
61}
void add(const std::string op, std::unique_ptr< GraphBuilder > &&builder)

References add().

◆ GraphBuilderRegistry() [2/2]

moco::GraphBuilderRegistry::GraphBuilderRegistry ( const GraphBuilderSource parent)
inline

Definition at line 48 of file GraphBuilderRegistry.h.

48 : _parent{parent}
49 {
50 // DO NOTHING
51 }

Member Function Documentation

◆ add()

void moco::GraphBuilderRegistry::add ( const std::string  op,
std::unique_ptr< GraphBuilder > &&  builder 
)
inline

Definition at line 73 of file GraphBuilderRegistry.h.

74 {
75 _builder_map[op] = std::move(builder);
76 }

Referenced by GraphBuilderRegistry().

◆ get()

static GraphBuilderRegistry & moco::GraphBuilderRegistry::get ( )
inlinestatic

Definition at line 66 of file GraphBuilderRegistry.h.

67 {
68 static GraphBuilderRegistry me;
69 return me;
70 }

Referenced by moco::Importer::import().

◆ lookup()

const GraphBuilder * moco::GraphBuilderRegistry::lookup ( const std::string &  op) const
inlinefinalvirtual

Returns registered GraphBuilder pointer for operator or nullptr if not registered.

Implements moco::GraphBuilderSource.

Definition at line 58 of file GraphBuilderRegistry.h.

59 {
60 if (_builder_map.find(op) == _builder_map.end())
61 return (_parent == nullptr) ? nullptr : _parent->lookup(op);
62
63 return _builder_map.at(op).get();
64 }
virtual const GraphBuilder * lookup(const std::string &op) const =0
Returns registered GraphBuilder pointer for operator (nullptr if not present)

References moco::GraphBuilderSource::lookup().


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