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
30{
31
33{
34public:
37
38public:
39 void convFloat32();
40
41 void configure(const IPortableTensor *input, const IPortableTensor *kernel,
42 const IPortableTensor *bias, ir::PaddingType _paddingType,
43 const uint32_t paddingLeft, const uint32_t paddingRight, const uint32_t paddingTop,
44 const uint32_t paddingBottom, const uint32_t strideWidth,
45 const uint32_t strideHeight, const uint32_t dilationWidthFactor,
46 const uint32_t dilationHeightFactor, const ir::Activation activation,
47 IPortableTensor *output, const std::shared_ptr<ExternalContext> &external_context);
48
49 void run() override;
50
51 void prepare() override;
52
53private:
54 const IPortableTensor *_input;
55 const IPortableTensor *_kernel;
56 const IPortableTensor *_bias;
57 IPortableTensor *_output;
58
59 ir::PaddingType _paddingType;
60 uint32_t _paddingLeft;
61 uint32_t _paddingTop;
62 uint32_t _paddingRight;
63 uint32_t _paddingBottom;
64
65 uint32_t _strideWidth;
66 uint32_t _strideHeight;
67 uint32_t _dilationWidthFactor;
68 uint32_t _dilationHeightFactor;
69
70 ir::Activation _activation;
71
72 std::unique_ptr<nnfw::ruy::Conv> _conv_kernel;
73
74 bool _prepare;
75
76 std::shared_ptr<ExternalContext> _external_context;
77};
78
79} // namespace onert::backend::ruy::ops
80
81#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)