1 /* 2 * Copyright (c) 2022 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 GE_COMMON_H 17 #define GE_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 using std::string; 29 using std::cout; 30 using std::endl; 31 using std::map; 32 using std::ios; 33 using std::fstream; 34 using std::to_string; 35 using std::ifstream; 36 using std::stringstream; 37 using std::max; 38 using std::min; 39 using std::vector; 40 // using namespace mindspore::tensor; 41 42 bool compFp32WithTData(float *actualOutputData, 43 const std::string &expectedDataFile, float rtol, 44 float atol, bool isquant); 45 bool allclose_int8(int8_t *a, int8_t *b, uint64_t count, float rtol, float atol, 46 bool isquant); 47 bool compUint8WithTData(uint8_t *actualOutputData, 48 const std::string &expectedDataFile, float rtol, 49 float atol, bool isquant); 50 //// add for mslite test of int64: 51 void getDimInfo(FILE *fp, std::vector<int64_t>* dim_info); 52 char *ReadFile(const char *file, size_t* size); 53 void PackNCHWToNHWCFp32(const char *src, char *dst, int batch, int plane, int channel); 54 55 #endif // GE_COMMON_H