ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Array.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
3 * Copyright (C) 2017 The Android Open Source Project
4 * Copyright 2018 The TensorFlow Authors. All Rights Reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef __ARRAY_H__
20#define __ARRAY_H__
21
22#include "Shape.h"
23#include "Dims.h"
24
25#include "Macro.h"
26
27// From types.h in TensorFlow Lite
28//
29// Get common array size, DCHECKing that they all agree.
30template <typename ArrayType1, typename ArrayType2>
31int MatchingArraySize(const ArrayType1 &array1, int index1, const ArrayType2 &array2, int index2)
32{
33 DCHECK_EQ(ArraySize(array1, index1), ArraySize(array2, index2));
34 return ArraySize(array1, index1);
35}
36
37// From types.h in TensorFlow Lite
38template <typename ArrayType1, typename ArrayType2, typename... Args>
39int MatchingArraySize(const ArrayType1 &array1, int index1, const ArrayType2 &array2, int index2,
40 Args... args)
41{
42 DCHECK_EQ(ArraySize(array1, index1), ArraySize(array2, index2));
43 return MatchingArraySize(array1, index1, args...);
44}
45
46#endif // __ARRAY_H__
int ArraySize(const Dims< N > &array, int index)
Definition Dims.h:76
#define DCHECK_EQ(x, y)
Definition Macro.h:29
int MatchingArraySize(const ArrayType1 &array1, int index1, const ArrayType2 &array2, int index2)
Definition Array.h:31