1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__
#define __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__
#include <stdint.h>
namespace neurun
{
namespace util
{
namespace feature
{
/**
* @brief Class to represent position(offset) of subtensor.\n
* Assume that parent and child are already lowered (can get Shape4D).
*/
class Coordinate4D
{
public:
/**
* @brief Construct a new Coordinate4D object
*/
Coordinate4D(void) : _n{0}, _h{0}, _w{0}, _c{0}
{
// DO NOTHING
}
/**
* @brief Construct a new Coordinate4D object
* @param[in] n Batch offset
* @param[in] h Height offset
* @param[in] w Width offset
* @param[in] c Channel offset
* @return
*/
Coordinate4D(int32_t n, int32_t h, int32_t w, int32_t c) : _n{n}, _h{h}, _w{w}, _c{c}
{
// DO NOTHING
}
public:
/**
* @brief Set batch offset
* @param[in] n Batch offset
*/
void n(int32_t n) { _n = n; }
/**
* @brief Set height offset
* @param[in] h Height offset
*/
void h(int32_t h) { _h = h; }
/**
* @brief Set width offset
* @param[in] w Width offset
*/
void w(int32_t w) { _w = w; }
/**
* @brief Set channel offset
* @param[in] c Channel offset
*/
void c(int32_t c) { _c = c; }
public:
/**
* @brief Return batch offset
* @return Batch offset
*/
int32_t n(void) const { return _n; }
/**
* @brief Return height offset
* @return Height offset
*/
int32_t h(void) const { return _h; }
/**
* @brief Return width offset
* @return Width offset
*/
int32_t w(void) const { return _w; }
/**
* @brief Return channel offset
* @return Channel offset
*/
int32_t c(void) const { return _c; }
private:
int32_t _n;
int32_t _h;
int32_t _w;
int32_t _c;
};
} // namespace feature
} // namespace util
} // namespace neurun
#endif // __NEURUN_UTIL_FEATURE_COORDINATE_4D_H__
|