ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Backend.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 __ONERT_BACKEND_RUY_BACKEND_H__
18#define __ONERT_BACKEND_RUY_BACKEND_H__
19
20#include "BackendContext.h"
21#include "Config.h"
22#include "KernelGenerator.h"
23
24#include <backend/Backend.h>
25
26#include <memory>
27
29{
30
32{
33public:
34 Backend() : _config{std::make_shared<Config>()} {}
35
36 std::shared_ptr<IConfig> config() const override { return _config; }
37
38 std::unique_ptr<onert::backend::BackendContext> newContext(ContextData &&data) const override
39 {
40 auto custom_kernel_builder = data.custom_kernel_builder;
41 auto &graph = *data.graph;
42 auto context = std::make_unique<BackendContext>(this, std::move(data));
43 auto tr = std::make_shared<basic::TensorRegistry>();
44 auto tb = std::make_shared<TensorBuilder>(tr);
45 context->tensor_registry = tr;
46 context->tensor_builder = tb;
47 context->kernel_gen = std::make_shared<KernelGenerator>(graph, tb, tr, custom_kernel_builder,
48 context->external_context());
49 return context;
50 }
51
52private:
53 std::shared_ptr<IConfig> _config;
54};
55
56} // namespace onert::backend::ruy
57
58#endif // __ONERT_BACKEND_RUY_BACKEND_H__
std::shared_ptr< IConfig > config() const override
Definition Backend.h:36
std::unique_ptr< onert::backend::BackendContext > newContext(ContextData &&data) const override
Definition Backend.h:38