• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From b3b93e2f260e89c680e0dee43205904d214737e0 Mon Sep 17 00:00:00 2001
2From: fangzhou12 <fangzhou12@huawei.com>
3Date: Fri, 9 Jun 2023 15:35:41 +0800
4Subject: [PATCH] log modeify
5
6---
7 mindspore/lite/src/runtime/js_api/mslite_model_napi.cc | 9 ++++++---
8 1 file changed, 6 insertions(+), 3 deletions(-)
9
10diff --git a/mindspore/lite/src/runtime/js_api/mslite_model_napi.cc b/mindspore/lite/src/runtime/js_api/mslite_model_napi.cc
11index 6cccb259..7ee4b071 100644
12--- a/mindspore/lite/src/runtime/js_api/mslite_model_napi.cc
13+++ b/mindspore/lite/src/runtime/js_api/mslite_model_napi.cc
14@@ -354,7 +354,7 @@ int32_t MSLiteModelNapi::ParseContextInfo(napi_env env, napi_value args, Context
15   napi_valuetype valueType;
16   napi_status status = napi_typeof(env, args, &valueType);
17   if ((status != napi_ok) || (valueType != napi_object)) {
18-    MS_LOG(ERROR) << "model is invaild.";
19+    MS_LOG(ERROR) << "context is invaild.";
20     return ERR_NOT_EXISTED_PARAM;
21   }
22
23@@ -692,6 +692,10 @@ int32_t MSLiteModelNapi::GetCpuDeviceInfo(napi_env env, napi_value args, Context
24
25   if (CommonNapi::GetPropertyInt32(env, config_item, "threadAffinityMode", int_value) == SUCCESS) {
26     MS_LOG(DEBUG) << "threadAffinityMode: " << int_value;
27+    if (int_value > PARAM2 || int_value < PARAM0) {
28+        MS_LOG(ERROR) << "threadAffinityMode value is set out of limitions";
29+        return ERR_INVALID_OPERATION;
30+    }
31     context.cpu_device.thread_affinity_mode = int_value;
32   } else {
33     context.cpu_device.thread_affinity_mode = PARAM0;
34@@ -730,7 +734,7 @@ napi_value MSLiteModelNapi::GetInputs(napi_env env, napi_callback_info info) {
35
36   status = napi_unwrap(env, jsThis, reinterpret_cast<void **>(&modelNapi));
37   if (status != napi_ok || modelNapi == nullptr) {
38-    MS_LOG(ERROR) << "get model napi error";
39+    MS_LOG(ERROR) << "Failed to get model";
40     return undefinedResult;
41   }
42
43@@ -893,7 +897,6 @@ napi_value MSLiteModelNapi::Resize(napi_env env, napi_callback_info info) {
44     }
45
46     status = napi_get_array_length(env, dim_element, &dim_size);
47-    MS_LOG(ERROR) << "DIM SIZE IS:" << dim_size;
48     if (status != napi_ok) {
49       MS_LOG(ERROR) << "get new dim size error";
50       return undefinedResult;
51--
522.17.1
53
54