提交 535473ce 编写于 作者: H Huihuang Zheng

Remove redundant JNI dependencies and replace for loop copy with memcpy

上级 c440043b
......@@ -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})
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册