• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 Huawei Technologies Co., Ltd
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 NNACL_TENSORC_UTILS_H_
18 #define NNACL_TENSORC_UTILS_H_
19 
20 #include <stddef.h>
21 #include "nnacl/errorcode.h"
22 #include "nnacl/op_base.h"
23 #include "nnacl/tensor_c.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 int GetBatch(const TensorC *tensor);
30 int GetHeight(const TensorC *tensor);
31 int GetWidth(const TensorC *tensor);
32 int GetChannel(const TensorC *tensor);
33 void NnaclSetBatch(TensorC *tensor, int batch);
34 void SetHeight(TensorC *tensor, int height);
35 void SetWidth(TensorC *tensor, int width);
36 void SetChannel(TensorC *tensor, int channel);
37 int GetElementNum(const TensorC *tensor);
38 int GetSize(const TensorC *tensor);
39 int GetDimensionSize(const TensorC *tensor, const size_t index);
40 bool IsShapeSame(const TensorC *tensor1, const TensorC *tensor2);
41 bool IsConst(const TensorC *tensor);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif  // NNACL_TENSORC_UTILS_H_
48