ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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
24namespace onert
25{
26namespace backend
27{
28namespace train
29{
30namespace ops
31{
32
37{
38public:
39 virtual void forward(const IPortableTensor *in, IPortableTensor *out) = 0;
40 virtual void backward(const IPortableTensor *back_prop_out, IPortableTensor *back_prop_in) = 0;
42 virtual ~TrainingKernelRegistry() = default;
43};
44
45enum class PoolType
46{
47 kMax,
48 kAvg,
49};
50
52{
53public:
54 PoolLayer();
55
56public:
57 void configureBackward(const uint32_t paddingLeft, const uint32_t paddingRight,
58 const uint32_t paddingTop, const uint32_t paddingBottom,
59 const uint32_t strideWidth, const uint32_t strideHeight,
60 const uint32_t kernelWidth, const uint32_t kernelHeight,
61 const ir::Activation activation, const PoolType op_type,
62 IPortableTensor *output, IPortableTensor *back_prop_input,
63 const IPortableTensor *back_prop_output);
64
65 void forward(bool training) override;
66 void backward() override;
67
68private:
69 IPortableTensor *_back_prop_input;
70 const IPortableTensor *_back_prop_output;
71
72 std::unique_ptr<TrainingKernelRegistry> _kernel;
73};
74
75} // namespace ops
76} // namespace train
77} // namespace backend
78} // namespace onert
79
80#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:194
void forward(bool training) override
Definition PoolLayer.cc:228
virtual void forward(const IPortableTensor *in, IPortableTensor *out)=0
virtual void backward(const IPortableTensor *back_prop_out, IPortableTensor *back_prop_in)=0