!26253 [MS][LITE][develop] fix vs build and run bug

Merge pull request !26253 from sunsuodong/fix_vs_build
This commit is contained in:
i-robot 2021-11-15 01:41:29 +00:00 committed by Gitee
commit c8e303f9a7
8 changed files with 22 additions and 15 deletions

View File

@ -22,7 +22,8 @@ void var2Invar(float *save_var, int size, float eps) {
save_var[i] = 1.0f / sqrtf(save_var[i] + eps);
}
}
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
void backwardAll(const float *in, const float *yt, const float *mean, const float *invar, const float *scale, int size,
int ch, float *dbias, float *dscale, float *dx) {
#else
@ -52,7 +53,7 @@ void backwardAll(const float *restrict in, const float *restrict yt, const float
}
}
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
void backwardP1(const float *in, const float *yt, const float *mean, const float *invar, const float *scale, int size,
int ch, float *dbias, float *dscale) {
#else
@ -71,9 +72,9 @@ void backwardP1(const float *restrict in, const float *restrict yt, const float
}
}
#ifdef SUPPORT_MSVC
#ifdef _MSC_VER
void backwardP2(const float *in, const float *yt, const float *mean, const float *invar, const float *dscale,
const float *dbias, const float *scale, int size, int total_size, int ch, float *restrict dx) {
const float *dbias, const float *scale, int size, int total_size, int ch, float *dx) {
#else
void backwardP2(const float *restrict in, const float *restrict yt, const float *restrict mean,
const float *restrict invar, const float *restrict dscale, const float *restrict dbias,

View File

@ -205,8 +205,11 @@ class ActorBase {
AID id;
std::map<std::string, ActorFunction> actionFunctions;
#ifdef _MSC_VER
std::recursive_mutex waiterLock;
#else
std::mutex waiterLock;
#endif
std::string msgRecords[MAX_ACTOR_RECORD_SIZE];
uint32_t recordNextPoint = 0;

View File

@ -17,8 +17,8 @@ else()
set(SECURE_C_FLAGS "-fPIC -fPIE -fstack-protector-strong")
set(SECURE_CXX_FLAGS "-fPIC -fPIE -fstack-protector-strong")
if(WIN32)
set(SECURE_SHARED_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase")
set(SECURE_EXE_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase")
set(SECURE_SHARED_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase -s")
set(SECURE_EXE_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase -s")
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(SECURE_SHARED_LINKER_FLAGS "-Wl,--no-seh ${SECURE_SHARED_LINKER_FLAGS}")
set(SECURE_EXE_LINKER_FLAGS "-Wl,--no-seh ${SECURE_EXE_LINKER_FLAGS}")

View File

@ -154,7 +154,7 @@ int QuickStart(int argc, const char **argv) {
delete[](model_buf);
if (build_ret != mindspore::kSuccess) {
delete model;
std::cerr << "Build model error " << build_ret << std::endl;
std::cerr << "Build model error " << build_ret.StatusCode() << std::endl;
return -1;
}
@ -174,7 +174,7 @@ int QuickStart(int argc, const char **argv) {
auto predict_ret = model->Predict(inputs, &outputs);
if (predict_ret != mindspore::kSuccess) {
delete model;
std::cerr << "Predict error " << predict_ret << std::endl;
std::cerr << "Predict error " << predict_ret.StatusCode() << std::endl;
return -1;
}

View File

@ -28,9 +28,10 @@
#include <cstdlib>
#include "securec/include/securec.h"
#if defined(_WIN32) && defined(SUPPORT_MSVC)
#ifdef _MSC_VER
#define PATH_MAX 1024
#define F_OK 0
#define R_OK 4
#endif
namespace mindspore {

View File

@ -154,6 +154,7 @@ bool IsSupportSDot() {
#endif
return status;
}
size_t GetMaxMallocSize() {
size_t max_malloc_size = 0;
#if defined(_MSC_VER) || defined(_WIN32)

View File

@ -28,10 +28,6 @@
#include "include/errorcode.h"
#include "ir/dtype/type_id.h"
#ifndef EXPORT_WRAPPER
#define EXPORT_WRAPPER __attribute__((visibility("default")))
#endif
namespace mindspore {
namespace lite {
enum NodeType {
@ -46,7 +42,7 @@ uint64_t GetTimeUs();
bool IsSupportSDot();
size_t EXPORT_WRAPPER GetMaxMallocSize();
size_t GetMaxMallocSize();
#ifdef __ANDROID__
uint32_t getHwCap(int hwcap_type);

View File

@ -139,6 +139,11 @@ MSTensor *MSTensor::CreateDevTensor(const std::vector<char> &name, enum DataType
return nullptr;
}
MSTensor *MSTensor::CreateImageTensor(const std::vector<char> &image_file) noexcept {
MS_LOG(ERROR) << "Unsupported Feature.";
return nullptr;
}
MSTensor *MSTensor::CharStringsToTensor(const std::vector<char> &name, const std::vector<std::vector<char>> &inputs) {
#ifndef STRING_KERNEL_CLIP
auto impl = Impl::StringsToTensorImpl(CharToString(name), VectorCharToString(inputs));