diff options
Diffstat (limited to 'include/util/feature/IndexIterator.h')
-rw-r--r-- | include/util/feature/IndexIterator.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/include/util/feature/IndexIterator.h b/include/util/feature/IndexIterator.h deleted file mode 100644 index e2a7196e8..000000000 --- a/include/util/feature/IndexIterator.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 __NNFW_UTIL_FEATURE_INDEX_ITERATOR_H__ -#define __NNFW_UTIL_FEATURE_INDEX_ITERATOR_H__ - -#include "util/feature/Shape.h" - -namespace nnfw -{ -namespace util -{ -namespace feature -{ - -class IndexIterator -{ -public: - IndexIterator(const Shape &shape) : _shape{shape} - { - // DO NOTHING - } - -public: - template <typename Callable> IndexIterator &iter(Callable cb) - { - for (int32_t batch = 0; batch < _shape.N; ++batch) - { - for (int32_t ch = 0; ch < _shape.C; ++ch) - { - for (int32_t row = 0; row < _shape.H; ++row) - { - for (int32_t col = 0; col < _shape.W; ++col) - { - cb(batch, ch, row, col); - } - } - } - } - - return (*this); - } - -private: - const Shape _shape; -}; - -static inline IndexIterator iterate(const Shape &shape) { return IndexIterator{shape}; } - -template <typename Callable> IndexIterator &operator<<(IndexIterator &&it, Callable cb) -{ - return it.iter(cb); -} - -} // namespace feature -} // namespace util -} // namespace nnfw - -#endif // __NNFW_UTIL_FEATURE_INDEX_ITERATOR_H__ |