diff --git a/src/jni/paddle_mobile_jni.cpp b/src/jni/paddle_mobile_jni.cpp index 66150e24e0ac957773161904948c10cf4637ee42..c8ed491672920d85adafa28316663ede64a6dcc9 100644 --- a/src/jni/paddle_mobile_jni.cpp +++ b/src/jni/paddle_mobile_jni.cpp @@ -206,6 +206,13 @@ JNIEXPORT jfloatArray JNICALL Java_com_baidu_paddle_PML_predictYuv( return result; } +JNIEXPORT void JNICALL Java_com_baidu_paddle_PML_setThread(JNIEnv *env, + jclass thiz, + jint threadCount) { + ANDROIDLOGI("setThreadCount %d", threadCount); + getPaddleMobileInstance()->SetThreadNum((int)threadCount); +} + JNIEXPORT void JNICALL Java_com_baidu_paddle_PML_clear(JNIEnv *env, jclass thiz) { getPaddleMobileInstance()->Clear(); diff --git a/src/jni/paddle_mobile_jni.h b/src/jni/paddle_mobile_jni.h index 06fabe04c739dfcee06110a3592a88591e3d37b9..4fd62a6d56c71dfc748cc967244bc830abb74a80 100644 --- a/src/jni/paddle_mobile_jni.h +++ b/src/jni/paddle_mobile_jni.h @@ -64,6 +64,12 @@ JNIEXPORT jfloatArray JNICALL Java_com_baidu_paddle_PML_predictYuv( JNIEXPORT jfloatArray JNICALL Java_com_baidu_paddle_PML_predict(JNIEnv *env, jclass thiz, jfloatArray buf); +/** + * setThreadCount for multithread + */ +JNIEXPORT void JNICALL Java_com_baidu_paddle_PML_setThread(JNIEnv *env, + jclass thiz, + jint threadCount); /** * clear data of the net when destroy for android */