ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Index.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
23#ifndef __NNFW_MISC_FEATURE_INDEX_H__
24#define __NNFW_MISC_FEATURE_INDEX_H__
25
26#include <cstdint>
27
28namespace nnfw
29{
30namespace misc
31{
32namespace feature
33{
34
38class Index
39{
40public:
44 Index() = default;
45
46public:
53 Index(int32_t ch, int32_t row, int32_t col) : _batch{1}, _ch{ch}, _row{row}, _col{col}
54 {
55 // DO NOTHING
56 }
64 Index(int32_t batch, int32_t ch, int32_t row, int32_t col)
65 : _batch{batch}, _ch{ch}, _row{row}, _col{col}
66 {
67 // DO NOTHING
68 }
69
70public:
75 int32_t batch(void) const { return _batch; }
80 int32_t ch(void) const { return _ch; }
85 int32_t row(void) const { return _row; }
90 int32_t col(void) const { return _col; }
91
92public:
97 int32_t &batch(void) { return _batch; }
102 int32_t &ch(void) { return _ch; }
107 int32_t &row(void) { return _row; }
112 int32_t &col(void) { return _col; }
113
114private:
118 int32_t _batch;
122 int32_t _ch;
126 int32_t _row;
130 int32_t _col;
131};
132
133} // namespace feature
134} // namespace misc
135} // namespace nnfw
136
137#endif // __NNFW_MISC_FEATURE_INDEX_H__
Class to have the index information for calculating the offset.
Definition Index.h:39
int32_t row(void) const
Get the height index.
Definition Index.h:85
int32_t & row(void)
Get the height index as the lvalue reference.
Definition Index.h:107
int32_t & col(void)
Get the width index as the lvalue reference.
Definition Index.h:112
int32_t & ch(void)
Get the depth index as the lvalue reference.
Definition Index.h:102
int32_t col(void) const
Get the width index.
Definition Index.h:90
Index(int32_t batch, int32_t ch, int32_t row, int32_t col)
Construct Index object with four indexes of dimensions.
Definition Index.h:64
Index()=default
Construct Index object using default constrcutor.
int32_t & batch(void)
Get the batch index as the lvalue reference.
Definition Index.h:97
int32_t ch(void) const
Get the depth index.
Definition Index.h:80
Index(int32_t ch, int32_t row, int32_t col)
Construct Index object with three indexes of dimensions.
Definition Index.h:53
int32_t batch(void) const
Get the batch index.
Definition Index.h:75
Definition topk_v2.h:30