diff --git a/paddle/fluid/lite/api/android/jni/CMakeLists.txt b/paddle/fluid/lite/api/android/jni/CMakeLists.txt index 0ce3b606e80143c8d5e44a9d7619d626c45d4dd1..245fd45859c92188ce0bc23396ee147db5cbc698 100644 --- a/paddle/fluid/lite/api/android/jni/CMakeLists.txt +++ b/paddle/fluid/lite/api/android/jni/CMakeLists.txt @@ -37,8 +37,7 @@ add_custom_target( include_directories(${JNI_INCLUDE_DIRS} ${_classDir} ${_stubDir}) lite_cc_library(paddle_lite_jni MODULE SRCS paddle_lite_jni.cc DEPS light_api_lite cxx_api_lite - paddle_api_full paddle_api_lite paddle_api_light op_registry_lite - ${ops_lite} ${lite_kernel_deps} + paddle_api_full paddle_api_lite paddle_api_light ARM_DEPS ${arm_kernels}) if (APPLE) # MacOS only accepts JNI lib ends with .jnilib or .dylib @@ -48,5 +47,4 @@ elseif (WIN32) set_target_properties(paddle_lite_jni PROPERTIES SUFFIX ".dll") endif (APPLE) target_link_libraries(paddle_lite_jni light_api_lite cxx_api_lite - paddle_api_full paddle_api_lite paddle_api_light op_registry_lite - ${ops_lite} ${arm_kernels} ${lite_kernel_deps}) + paddle_api_full paddle_api_lite paddle_api_light ${arm_kernels}) diff --git a/paddle/fluid/lite/api/android/jni/paddle_lite_jni.cc b/paddle/fluid/lite/api/android/jni/paddle_lite_jni.cc index 4ef0c2ee55d42cb9583cb66ac5c493232247085e..dc5bd8e1a3682c916fbcdb20437fd3c6b13ff613 100644 --- a/paddle/fluid/lite/api/android/jni/paddle_lite_jni.cc +++ b/paddle/fluid/lite/api/android/jni/paddle_lite_jni.cc @@ -248,9 +248,7 @@ Java_com_baidu_paddle_lite_PaddlePredictor_setInput__I_3I_3F( predictor->GetInput(static_cast<int>(offset)); tensor->Resize(ddim); float *input = tensor->mutable_data<float>(); - for (int i = 0; i < len; ++i) { - input[i] = buffer[i]; - } + memcpy(input, buffer, sizeof(float) * len); return JNI_TRUE; } @@ -272,9 +270,7 @@ Java_com_baidu_paddle_lite_PaddlePredictor_setInput__I_3I_3B( predictor->GetInput(static_cast<int>(offset)); tensor->Resize(ddim); int8_t *input = tensor->mutable_data<int8_t>(); - for (int i = 0; i < len; ++i) { - input[i] = (int8_t)buffer[i]; - } + memcpy(input, buffer, sizeof(int8_t) * len); return JNI_TRUE; }