• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_MINDSPORE_COMMON_H
17 #define OHOS_MINDSPORE_COMMON_H
18 
19 #include <cstdio>
20 #include <cstdlib>
21 #include <fstream>
22 #include <iostream>
23 #include <string>
24 #include <vector>
25 #include <map>
26 #include <math.h>
27 
28 bool compFp32WithTData(float *actualOutputData,
29                        const std::string &expectedDataFile, float rtol,
30                        float atol, bool isquant);
31 bool allclose_int8(int8_t *a, int8_t *b, uint64_t count, float rtol, float atol,
32                    bool isquant);
33 bool compUint8WithTData(uint8_t *actualOutputData,
34                         const std::string &expectedDataFile, float rtol,
35                         float atol, bool isquant);
36 //// add for mslite test of int64:
37 void getDimInfo(FILE *fp, std::vector<int64_t>* dim_info);
38 char *ReadFile(const char *file, size_t* size);
39 void PackNCHWToNHWCFp32(const char *src, char *dst, int batch, int plane, int channel);
40 char **TransStrVectorToCharArrays(const std::vector<std::string> &s);
41 std::vector<std::string> TransCharArraysToStrVector(char **c, const size_t &num);
42 
43 #endif //OHOS_MINDSPORE_COMMON_H
44