ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Module.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_MODULE_H__
18#define __LUCI_MODULE_H__
19
20#include <loco/IR/Graph.h>
21
22#include <map>
23#include <memory>
24#include <vector>
25
26namespace luci
27{
28
32class Module final
33{
34public:
35 Module() = default;
36
37 // Copy/Move is not allowed for Module
38 Module(const Module &) = delete;
39 Module(Module &&) = delete;
40
41 ~Module() = default;
42
43public:
44 size_t size(void) const { return _graphs.size(); }
45
46public:
47 void add(std::unique_ptr<loco::Graph> &&g);
48
52 loco::Graph *graph(void) const;
53
59 loco::Graph *graph(size_t idx) const;
60
61 // TODO provide graph accessor with a name
62
63public:
64 void ext_buffer(bool set) { _ext_buffer = set; }
65 bool ext_buffer(void) const { return _ext_buffer; }
66
67private:
68 bool _ext_buffer = false;
69
70public:
71 void source_table(const std::map<uint32_t, std::string> &table) { _source_table = table; }
72
73 const std::map<uint32_t, std::string> &source_table(void) const { return _source_table; }
74
75private:
76 std::vector<std::unique_ptr<loco::Graph>> _graphs;
77
78private:
90 std::map<uint32_t, std::string> _source_table;
91};
92
93std::unique_ptr<Module> make_module(void);
94
95} // namespace luci
96
97#endif // __LUCI_MODULE_H__
A neural network graph.
Definition Graph.h:161
Collection of 'loco::Graph's.
Definition Module.h:33
bool ext_buffer(void) const
Definition Module.h:65
const std::map< uint32_t, std::string > & source_table(void) const
Definition Module.h:73
Module(const Module &)=delete
size_t size(void) const
Definition Module.h:44
void source_table(const std::map< uint32_t, std::string > &table)
Definition Module.h:71
loco::Graph * graph(void) const
provide main graph
Definition Module.cpp:32
Module(Module &&)=delete
void add(std::unique_ptr< loco::Graph > &&g)
Definition Module.cpp:24
~Module()=default
Module()=default
void ext_buffer(bool set)
Definition Module.h:64
std::unique_ptr< Module > make_module(void)
Definition Module.cpp:44