ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Padding.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_IR_PADDIGN_H__
18#define __ONERT_IR_PADDIGN_H__
19
20#include "Shape.h"
21#include "InternalType.h"
22
23#include <cstdint>
24#include <string>
25
26namespace onert::ir
27{
28
29enum class PaddingType
30{
31 EXPLICIT = 0,
32 SAME = 1,
33 VALID = 2
34};
35
41inline std::string to_string(const PaddingType type);
42
44{
45 uint32_t left;
46 uint32_t right;
47 uint32_t top;
48 uint32_t bottom;
49};
50
51// TODO Resolve explicit padding param at frontend and save in value field
52struct Padding
53{
54 Padding(void);
55 Padding(PaddingType paddingType);
56 Padding(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom);
57
58 // TODO Change to private field
61};
62
63// TODO Change to Padding struct's method
64const ExplicitPadding calculatePadding(const Padding &padding, const FeatureShape &ifm_shape,
65 const FeatureShape &ofm_shape, const Stride &stride,
66 uint32_t kw, uint32_t kh, uint32_t dwf = 1,
67 uint32_t dhf = 1);
68
69} // namespace onert::ir
70
71#endif
const ExplicitPadding calculatePadding(const Padding &padding, const FeatureShape &ifm_shape, const FeatureShape &ofm_shape, const Stride &stride, uint32_t kw, uint32_t kh, uint32_t dwf=1, uint32_t dhf=1)
Definition Padding.cc:131
std::string to_string(Layout layout)
Definition Layout.h:41
Structure to have values of dimensions for feature.
Definition Shape.h:34
PaddingType type
Definition Padding.h:59
ExplicitPadding param
Definition Padding.h:60