ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PoolLayer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 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_TRAIN_OPS_POOLLAYER_H__
18#define __ONERT_BACKEND_TRAIN_OPS_POOLLAYER_H__
19
20#include <ops/PoolLayer.h>
21
23
25{
26
31{
32public:
33 virtual void forward(const IPortableTensor *in, IPortableTensor *out) = 0;
34 virtual void backward(const IPortableTensor *back_prop_out, IPortableTensor *back_prop_in) = 0;
36 virtual ~TrainingKernelRegistry() = default;
37};
38
39enum class PoolType
40{
41 kMax,
42 kAvg,
43};
44
46{
47public:
48 PoolLayer();
49
50public:
51 void configureBackward(const uint32_t paddingLeft, const uint32_t paddingRight,
52 const uint32_t paddingTop, const uint32_t paddingBottom,
53 const uint32_t strideWidth, const uint32_t strideHeight,
54 const uint32_t kernelWidth, const uint32_t kernelHeight,
55 const ir::Activation activation, const PoolType op_type,
56 IPortableTensor *output, IPortableTensor *back_prop_input,
57 const IPortableTensor *back_prop_output);
58
59 void forward(bool training) override;
60 void backward() override;
61
62private:
63 IPortableTensor *_back_prop_input;
64 const IPortableTensor *_back_prop_output;
65
66 std::unique_ptr<TrainingKernelRegistry> _kernel;
67};
68
69} // namespace onert::backend::train::ops
70
71#endif // __ONERT_BACKEND_TRAIN_OPS_POOLLAYER_H__
A tensor class that is portable for other backends.
void configureBackward(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 kernelWidth, const uint32_t kernelHeight, const ir::Activation activation, const PoolType op_type, IPortableTensor *output, IPortableTensor *back_prop_input, const IPortableTensor *back_prop_output)
Definition PoolLayer.cc:188
void forward(bool training) override
Definition PoolLayer.cc:222
virtual void forward(const IPortableTensor *in, IPortableTensor *out)=0
virtual void backward(const IPortableTensor *back_prop_out, IPortableTensor *back_prop_in)=0