ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Common.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
17#ifndef _MIR_COMMON_H_
18#define _MIR_COMMON_H_
19
20#include <cstddef>
21#include <cstdint>
22
23namespace mir
24{
28constexpr std::size_t MAX_DIMENSION_COUNT = 8;
29
30inline constexpr std::size_t wrap_index(std::int32_t index, std::size_t limit) noexcept
31{
32 return static_cast<std::size_t>(index >= 0 ? index : limit + index);
33}
34} // namespace mir
35
36#endif //_MIR_COMMON_H_
constexpr std::size_t MAX_DIMENSION_COUNT
maximum number of dimensions what an Index, Shape or Tensor can have
Definition Common.h:28
constexpr std::size_t wrap_index(std::int32_t index, std::size_t limit) noexcept
Definition Common.h:30