!22390 [MS][LITE]Fix cropping log
Merge pull request !22390 from gongdaguo/add_crop_int8
This commit is contained in:
commit
78841db66b
|
@ -194,6 +194,12 @@ if((MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_TESTCASES) AND (
|
||||||
"is configured as off, MSLITE_ENABLE_CONVERTER and MSLITE_ENABLE_TESTCASES must also be configured as off")
|
"is configured as off, MSLITE_ENABLE_CONVERTER and MSLITE_ENABLE_TESTCASES must also be configured as off")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(((MSLITE_GPU_BACKEND STREQUAL tensorrt) OR MSLITE_ENABLE_NPU) AND (
|
||||||
|
NOT MSLITE_DELEGATE_USE))
|
||||||
|
message(FATAL_ERROR "If MSLITE_DELEGATE_USE use is configured as off, MSLITE_ENABLE_NPU must also be configured
|
||||||
|
as off and MSLITE_GPU_BACKEND nor can it be configured as tensorrt.")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSLITE_ENABLE_FP16 AND PLATFORM_ARM32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
|
if(MSLITE_ENABLE_FP16 AND PLATFORM_ARM32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
|
||||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||||
message(FATAL_ERROR "If you want to build fp16 in arm82_a32, \
|
message(FATAL_ERROR "If you want to build fp16 in arm82_a32, \
|
||||||
|
|
|
@ -160,12 +160,10 @@ set(LITE_SRC
|
||||||
${KERNEL_REG_SRC}
|
${KERNEL_REG_SRC}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSLITE_DELEGATE_USE)
|
set(LITE_SRC
|
||||||
set(LITE_SRC
|
${LITE_SRC}
|
||||||
${LITE_SRC}
|
${CMAKE_CURRENT_SOURCE_DIR}/delegate/delegate.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/delegate/delegate.cc
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSLITE_GPU_BACKEND STREQUAL opencl)
|
if(MSLITE_GPU_BACKEND STREQUAL opencl)
|
||||||
file(GLOB_RECURSE OPENCL_RUNTIME_SRC
|
file(GLOB_RECURSE OPENCL_RUNTIME_SRC
|
||||||
|
|
|
@ -37,6 +37,10 @@ const char *const unsupport_delegate_log =
|
||||||
"The mindspore-lite library does not support delegate. Set environment variable "
|
"The mindspore-lite library does not support delegate. Set environment variable "
|
||||||
"MSLITE_DELEGATE_USE to on to "
|
"MSLITE_DELEGATE_USE to on to "
|
||||||
"recompile it.";
|
"recompile it.";
|
||||||
|
const char *const unsupport_v0_log =
|
||||||
|
"The mindspore-lite library does not support v0 ms. Set environment variable "
|
||||||
|
"MSLITE_ENABLE_V0 to on to "
|
||||||
|
"recompile it. Or use a new converter tool to re transform the model";
|
||||||
const char *const unsupport_fp16_log =
|
const char *const unsupport_fp16_log =
|
||||||
"The mindspore-lite library does not support fp16. Set environment variable "
|
"The mindspore-lite library does not support fp16. Set environment variable "
|
||||||
"MSLITE_ENABLE_FP16 to on to "
|
"MSLITE_ENABLE_FP16 to on to "
|
||||||
|
|
|
@ -351,7 +351,11 @@ int LiteModel::ConstructModel() {
|
||||||
flatbuffers::Verifier verify((const uint8_t *)this->buf, this->buf_size_);
|
flatbuffers::Verifier verify((const uint8_t *)this->buf, this->buf_size_);
|
||||||
schema_version_ = VersionVerify(&verify);
|
schema_version_ = VersionVerify(&verify);
|
||||||
if (schema_version_ == SCHEMA_INVALID) {
|
if (schema_version_ == SCHEMA_INVALID) {
|
||||||
MS_LOG(ERROR) << "The buffer is invalid and fail to create graph.";
|
MS_LOG(ERROR) << "The model buffer is invalid and fail to create graph.";
|
||||||
|
#ifndef ENABLE_V0
|
||||||
|
MS_LOG(ERROR) << "Maybe this is a model transferred out using the conversion tool before 1.1.0";
|
||||||
|
MS_LOG(ERROR) << unsupport_v0_log;
|
||||||
|
#endif
|
||||||
return RET_ERROR;
|
return RET_ERROR;
|
||||||
}
|
}
|
||||||
const void *meta_graph = GetMetaGraphByVerison();
|
const void *meta_graph = GetMetaGraphByVerison();
|
||||||
|
|
|
@ -676,7 +676,13 @@ int LiteSession::Init(InnerContext *context) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (context->delegate != nullptr) {
|
if (context->delegate != nullptr) {
|
||||||
|
#ifndef DELEGATE_CLIP
|
||||||
delegate_ = context->delegate;
|
delegate_ = context->delegate;
|
||||||
|
#else
|
||||||
|
MS_LOG(ERROR) << unsupport_delegate_log;
|
||||||
|
is_running_.store(false);
|
||||||
|
return RET_NOT_SUPPORT;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
ms_context_ = MSContextFromContext(context);
|
ms_context_ = MSContextFromContext(context);
|
||||||
if (ms_context_ == nullptr) {
|
if (ms_context_ == nullptr) {
|
||||||
|
@ -684,6 +690,7 @@ int LiteSession::Init(InnerContext *context) {
|
||||||
is_running_.store(false);
|
is_running_.store(false);
|
||||||
return RET_NULL_PTR;
|
return RET_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
#ifndef DELEGATE_CLIP
|
||||||
#if SUPPORT_NPU
|
#if SUPPORT_NPU
|
||||||
if (delegate_ == nullptr && context_->IsNpuEnabled()) {
|
if (delegate_ == nullptr && context_->IsNpuEnabled()) {
|
||||||
delegate_ = std::make_shared<NPUDelegate>(context_->GetNpuInfo());
|
delegate_ = std::make_shared<NPUDelegate>(context_->GetNpuInfo());
|
||||||
|
@ -704,7 +711,7 @@ int LiteSession::Init(InnerContext *context) {
|
||||||
delegate_device_type_ = DT_GPU;
|
delegate_device_type_ = DT_GPU;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef DELEGATE_CLIP
|
|
||||||
if (delegate_ != nullptr) {
|
if (delegate_ != nullptr) {
|
||||||
auto delegate_ret = delegate_->Init();
|
auto delegate_ret = delegate_->Init();
|
||||||
if (delegate_ret == mindspore::kLiteNotSupport) {
|
if (delegate_ret == mindspore::kLiteNotSupport) {
|
||||||
|
|
|
@ -18,12 +18,14 @@
|
||||||
#define MINDSPORE_LITE_SRC_OPS_POPULATE_POPULATE_REGISTER_H_
|
#define MINDSPORE_LITE_SRC_OPS_POPULATE_POPULATE_REGISTER_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
#include "schema/model_generated.h"
|
#include "schema/model_generated.h"
|
||||||
#include "nnacl/op_base.h"
|
#include "nnacl/op_base.h"
|
||||||
#include "src/common/common.h"
|
#include "src/common/common.h"
|
||||||
#include "src/common/log_adapter.h"
|
#include "src/common/log_adapter.h"
|
||||||
#include "src/common/prim_util.h"
|
#include "src/common/prim_util.h"
|
||||||
#include "src/common/version_manager.h"
|
#include "src/common/version_manager.h"
|
||||||
|
#include "src/common/utils.h"
|
||||||
|
|
||||||
namespace mindspore {
|
namespace mindspore {
|
||||||
namespace lite {
|
namespace lite {
|
||||||
|
@ -33,6 +35,11 @@ constexpr size_t kMinShapeSizeTwo = 2;
|
||||||
constexpr size_t kMinShapeSizeFour = 4;
|
constexpr size_t kMinShapeSizeFour = 4;
|
||||||
typedef OpParameter *(*ParameterGen)(const void *prim);
|
typedef OpParameter *(*ParameterGen)(const void *prim);
|
||||||
|
|
||||||
|
static const std::vector<schema::PrimitiveType> string_op = {
|
||||||
|
schema::PrimitiveType_CustomExtractFeatures, schema::PrimitiveType_CustomNormalize,
|
||||||
|
schema::PrimitiveType_CustomPredict, schema::PrimitiveType_HashtableLookup,
|
||||||
|
schema::PrimitiveType_LshProjection, schema::PrimitiveType_SkipGram};
|
||||||
|
|
||||||
class PopulateRegistry {
|
class PopulateRegistry {
|
||||||
public:
|
public:
|
||||||
static PopulateRegistry *GetInstance();
|
static PopulateRegistry *GetInstance();
|
||||||
|
@ -45,8 +52,16 @@ class PopulateRegistry {
|
||||||
ParameterGen param_creator = nullptr;
|
ParameterGen param_creator = nullptr;
|
||||||
auto iter = parameters_.find(GenPrimVersionKey(type, version));
|
auto iter = parameters_.find(GenPrimVersionKey(type, version));
|
||||||
if (iter == parameters_.end()) {
|
if (iter == parameters_.end()) {
|
||||||
MS_LOG(ERROR) << "Unsupported parameter type in Create : "
|
#ifdef STRING_KERNEL_CLIP
|
||||||
<< schema::EnumNamePrimitiveType(static_cast<schema::PrimitiveType>(type));
|
if (lite::IsContain(string_op, static_cast<schema::PrimitiveType>(type))) {
|
||||||
|
MS_LOG(ERROR) << unsupport_string_tensor_log;
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
MS_LOG(ERROR) << "Unsupported parameter type in Create : "
|
||||||
|
<< schema::EnumNamePrimitiveType(static_cast<schema::PrimitiveType>(type));
|
||||||
|
#ifdef STRING_KERNEL_CLIP
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
param_creator = iter->second;
|
param_creator = iter->second;
|
||||||
|
|
Loading…
Reference in New Issue