ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ConvolutionLayer.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_OPS_CONVOLUTIONLAYER_H__
18#define __ONERT_BACKEND_RUY_OPS_CONVOLUTIONLAYER_H__
19
21#include "../ExternalContext.h"
22#include "OperationUtils.h"
23
24#include <ruy/operation/Conv.h>
25#include <exec/IFunction.h>
26#include <functional>
27#include <memory>
28
29namespace onert
30{
31namespace backend
32{
33namespace ruy
34{
35namespace ops
36{
37
39{
40public:
43
44public:
45 void convFloat32();
46
47 void configure(const IPortableTensor *input, const IPortableTensor *kernel,
48 const IPortableTensor *bias, ir::PaddingType _paddingType,
49 const uint32_t paddingLeft, const uint32_t paddingRight, const uint32_t paddingTop,
50 const uint32_t paddingBottom, const uint32_t strideWidth,
51 const uint32_t strideHeight, const uint32_t dilationWidthFactor,
52 const uint32_t dilationHeightFactor, const ir::Activation activation,
53 IPortableTensor *output, const std::shared_ptr<ExternalContext> &external_context);
54
55 void run() override;
56
57 void prepare() override;
58
59private:
60 const IPortableTensor *_input;
61 const IPortableTensor *_kernel;
62 const IPortableTensor *_bias;
63 IPortableTensor *_output;
64
65 ir::PaddingType _paddingType;
66 uint32_t _paddingLeft;
67 uint32_t _paddingTop;
68 uint32_t _paddingRight;
69 uint32_t _paddingBottom;
70
71 uint32_t _strideWidth;
72 uint32_t _strideHeight;
73 uint32_t _dilationWidthFactor;
74 uint32_t _dilationHeightFactor;
75
76 ir::Activation _activation;
77
78 std::unique_ptr<nnfw::ruy::Conv> _conv_kernel;
79
80 bool _prepare;
81
82 std::shared_ptr<ExternalContext> _external_context;
83};
84
85} // namespace ops
86} // namespace ruy
87} // namespace backend
88} // namespace onert
89
90#endif // __ONERT_BACKEND_RUY_OPS_CONVOLUTIONLAYER_H__
A tensor class that is portable for other backends.
void configure(const IPortableTensor *input, const IPortableTensor *kernel, const IPortableTensor *bias, ir::PaddingType _paddingType, const uint32_t paddingLeft, const uint32_t paddingRight, const uint32_t paddingTop, const uint32_t paddingBottom, const uint32_t strideWidth, const uint32_t strideHeight, const uint32_t dilationWidthFactor, const uint32_t dilationHeightFactor, const ir::Activation activation, IPortableTensor *output, const std::shared_ptr< ExternalContext > &external_context)