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