ONE - On-device Neural Engine
Loading...
Searching...
No Matches
GraphBuilder.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __LUCI_IMPORT_GRAPH_BUILDER_H__
18#define __LUCI_IMPORT_GRAPH_BUILDER_H__
19
20#include "GraphBuilderContext.h"
21#include "GraphBuilderBase.h"
22
23#include <mio/circle/schema_generated.h>
24
25namespace luci
26{
27
32{
33public:
34 virtual ~GraphBuilder() = default;
35
36 // common validate method to check number of inputs and single output
37 bool validate(const ValidateArgs &args, size_t input_cnt) const
38 {
39 return (args.op.inputs.size() == input_cnt && args.op.outputs.size() == 1);
40 }
41
42 CircleNode *build(const circle::OperatorT &op, GraphBuilderContext *context) const final;
43
44private:
45 virtual CircleNode *build_node(const circle::OperatorT &op,
46 const std::vector<CircleNode *> &inputs,
47 loco::Graph *graph) const = 0;
48};
49
50} // namespace luci
51
52#endif // __LUCI_IMPORT_GRAPH_BUILDER_H__
A neural network graph.
Definition Graph.h:161
Class to store context to build loco graph IR from TensorFlow.
Base of general single output graph builder(e.g., Conv2DGraphBuilder)
virtual ~GraphBuilder()=default
CircleNode * build(const circle::OperatorT &op, GraphBuilderContext *context) const final
bool validate(const ValidateArgs &args, size_t input_cnt) const
Interface of convert circle::OperatorT to CircleNode.