ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Padding.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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
21#ifndef __PADDING_H__
22#define __PADDING_H__
23
24#include <cstdint>
25#include <vector>
26
30template <typename Derived> class PaddingBase
31{
32public:
33 virtual ~PaddingBase() = default;
34
35public:
36 uint32_t count(void) const { return _values.size(); }
37
38public:
39 uint32_t &value(uint32_t n) { return _values.at(n); }
40 const uint32_t &value(uint32_t n) const { return _values.at(n); }
41
42public:
43 void resize(uint32_t len) { return _values.resize(len); }
44
45private:
46 std::vector<uint32_t> _values;
47};
48
54struct RawPadding final : public PaddingBase<RawPadding>
55{
56 // Empty
57};
58
64struct SpatialPadding final : public PaddingBase<SpatialPadding>
65{
66 // Empty
67};
68
69#endif // __PADDING_H__
A PaddingBase encapsulates common implementation for derived Padding classes.
Definition Padding.h:31
const uint32_t & value(uint32_t n) const
Definition Padding.h:40
uint32_t & value(uint32_t n)
Definition Padding.h:39
virtual ~PaddingBase()=default
void resize(uint32_t len)
Definition Padding.h:43
uint32_t count(void) const
Definition Padding.h:36
A RawPadding denotes padding values stored in Caffe model.
Definition Padding.h:55
A SpatialPadding denotes padding values for each "spatial" dimension.
Definition Padding.h:65