!22390 [MS][LITE]Fix cropping log

Merge pull request !22390 from gongdaguo/add_crop_int8
This commit is contained in:
i-robot 2021-08-26 08:01:16 +00:00 committed by Gitee
commit 78841db66b
6 changed files with 44 additions and 10 deletions

View File

@ -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")
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"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
message(FATAL_ERROR "If you want to build fp16 in arm82_a32, \

View File

@ -160,12 +160,10 @@ set(LITE_SRC
${KERNEL_REG_SRC}
)
if(MSLITE_DELEGATE_USE)
set(LITE_SRC
${LITE_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/delegate/delegate.cc
)
endif()
set(LITE_SRC
${LITE_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/delegate/delegate.cc
)
if(MSLITE_GPU_BACKEND STREQUAL opencl)
file(GLOB_RECURSE OPENCL_RUNTIME_SRC

View File

@ -37,6 +37,10 @@ const char *const unsupport_delegate_log =
"The mindspore-lite library does not support delegate. Set environment variable "
"MSLITE_DELEGATE_USE to on to "
"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 =
"The mindspore-lite library does not support fp16. Set environment variable "
"MSLITE_ENABLE_FP16 to on to "

View File

@ -351,7 +351,11 @@ int LiteModel::ConstructModel() {
flatbuffers::Verifier verify((const uint8_t *)this->buf, this->buf_size_);
schema_version_ = VersionVerify(&verify);
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;
}
const void *meta_graph = GetMetaGraphByVerison();

View File

@ -676,7 +676,13 @@ int LiteSession::Init(InnerContext *context) {
return ret;
}
if (context->delegate != nullptr) {
#ifndef DELEGATE_CLIP
delegate_ = context->delegate;
#else
MS_LOG(ERROR) << unsupport_delegate_log;
is_running_.store(false);
return RET_NOT_SUPPORT;
#endif
}
ms_context_ = MSContextFromContext(context);
if (ms_context_ == nullptr) {
@ -684,6 +690,7 @@ int LiteSession::Init(InnerContext *context) {
is_running_.store(false);
return RET_NULL_PTR;
}
#ifndef DELEGATE_CLIP
#if SUPPORT_NPU
if (delegate_ == nullptr && context_->IsNpuEnabled()) {
delegate_ = std::make_shared<NPUDelegate>(context_->GetNpuInfo());
@ -704,7 +711,7 @@ int LiteSession::Init(InnerContext *context) {
delegate_device_type_ = DT_GPU;
}
#endif
#ifndef DELEGATE_CLIP
if (delegate_ != nullptr) {
auto delegate_ret = delegate_->Init();
if (delegate_ret == mindspore::kLiteNotSupport) {

View File

@ -18,12 +18,14 @@
#define MINDSPORE_LITE_SRC_OPS_POPULATE_POPULATE_REGISTER_H_
#include <map>
#include <vector>
#include "schema/model_generated.h"
#include "nnacl/op_base.h"
#include "src/common/common.h"
#include "src/common/log_adapter.h"
#include "src/common/prim_util.h"
#include "src/common/version_manager.h"
#include "src/common/utils.h"
namespace mindspore {
namespace lite {
@ -33,6 +35,11 @@ constexpr size_t kMinShapeSizeTwo = 2;
constexpr size_t kMinShapeSizeFour = 4;
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 {
public:
static PopulateRegistry *GetInstance();
@ -45,8 +52,16 @@ class PopulateRegistry {
ParameterGen param_creator = nullptr;
auto iter = parameters_.find(GenPrimVersionKey(type, version));
if (iter == parameters_.end()) {
MS_LOG(ERROR) << "Unsupported parameter type in Create : "
<< schema::EnumNamePrimitiveType(static_cast<schema::PrimitiveType>(type));
#ifdef STRING_KERNEL_CLIP
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;
}
param_creator = iter->second;