ONE - On-device Neural Engine
Loading...
Searching...
No Matches
RuntimeModule.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_INTERPRETER_CORE_RUNTIMEMODULE_H
18#define LUCI_INTERPRETER_CORE_RUNTIMEMODULE_H
19
20#include "core/RuntimeGraph.h"
21#include "core/EventNotifier.h"
23
24#include <memory>
25#include <vector>
26
27namespace luci_interpreter
28{
29
31{
32public:
33 explicit RuntimeModule(EventNotifier *event_notifier) : _event_notifier(event_notifier) {}
34
35 EventNotifier *getEventNotifier() const { return _event_notifier; }
36
38 {
39 _graphs.push_back(std::make_unique<RuntimeGraph>(this, memory_manager));
40 return _graphs.back().get();
41 }
42
43 const std::vector<Tensor *> &getInputTensors() const { return getMainGraph()->getInputTensors(); }
44 const std::vector<Tensor *> &getOutputTensors() const
45 {
46 return getMainGraph()->getOutputTensors();
47 }
48
49 void execute() const { getMainGraph()->execute(); }
50
51private:
52 RuntimeGraph *getMainGraph() const { return _graphs[0].get(); }
53
54 EventNotifier *const _event_notifier;
55 std::vector<std::unique_ptr<RuntimeGraph>> _graphs;
56};
57
58} // namespace luci_interpreter
59
60#endif // LUCI_INTERPRETER_CORE_RUNTIMEMODULE_H
const std::vector< Tensor * > & getOutputTensors() const
const std::vector< Tensor * > & getInputTensors() const
const std::vector< Tensor * > & getOutputTensors() const
RuntimeGraph * addGraph(IMemoryManager *memory_manager)
const std::vector< Tensor * > & getInputTensors() const
EventNotifier * getEventNotifier() const
RuntimeModule(EventNotifier *event_notifier)