2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @brief This file contains Index class
20 * @ingroup COM_AI_RUNTIME
23 #ifndef __NNFW_MISC_FEATURE_INDEX_H__
24 #define __NNFW_MISC_FEATURE_INDEX_H__
36 * @brief Class to have the index information for calculating the offset.
42 * @brief Construct Index object using default constrcutor
48 * @brief Construct Index object with three indexes of dimensions
49 * @param[in] ch The depth index
50 * @param[in] row The heigth index
51 * @param[in] col The width index
53 Index(int32_t ch, int32_t row, int32_t col) : _batch{1}, _ch{ch}, _row{row}, _col{col}
58 * @brief Construct Index object with four indexes of dimensions
59 * @param[in] batch The batch index
60 * @param[in] ch The depth index
61 * @param[in] row The height index
62 * @param[in] col The width index
64 Index(int32_t batch, int32_t ch, int32_t row, int32_t col)
65 : _batch{batch}, _ch{ch}, _row{row}, _col{col}
72 * @brief Get the batch index
73 * @return The batch index
75 int32_t batch(void) const { return _batch; }
77 * @brief Get the depth index
78 * @return The depth index
80 int32_t ch(void) const { return _ch; }
82 * @brief Get the height index
83 * @return The height index
85 int32_t row(void) const { return _row; }
87 * @brief Get the width index
88 * @return The width index
90 int32_t col(void) const { return _col; }
94 * @brief Get the batch index as the lvalue reference
95 * @return The reference of the batch value
97 int32_t &batch(void) { return _batch; }
99 * @brief Get the depth index as the lvalue reference
100 * @return The reference of the depth value
102 int32_t &ch(void) { return _ch; }
104 * @brief Get the height index as the lvalue reference
105 * @return The reference of the height value
107 int32_t &row(void) { return _row; }
109 * @brief Get the width index as the lvalue reference
110 * @return The reference of the width value
112 int32_t &col(void) { return _col; }
116 * @brief The batch index
120 * @brief The depth index
124 * @brief The height index
128 * @brief The width index
133 } // namespace feature
137 #endif // __NNFW_MISC_FEATURE_INDEX_H__