Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Apr 11, 2024
1 parent c4183a8 commit 5a58f5c
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions app/src/main/jni/squeezencnn_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ JNIEXPORT jboolean JNICALL Java_com_tencent_squeezencnn_SqueezeNcnn_Init(JNIEnv*
{
AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);

// use vulkan compute
if (ncnn::get_gpu_count() != 0)
squeezenet_gpu.opt.use_vulkan_compute = true;

// init param
{
int ret = squeezenet.load_param_bin(mgr, "squeezenet_v1.1.param.bin");
Expand All @@ -85,14 +81,6 @@ JNIEXPORT jboolean JNICALL Java_com_tencent_squeezencnn_SqueezeNcnn_Init(JNIEnv*
return JNI_FALSE;
}
}
{
int ret = squeezenet_gpu.load_param_bin(mgr, "squeezenet_v1.1.param.bin");
if (ret != 0)
{
__android_log_print(ANDROID_LOG_DEBUG, "SqueezeNcnn", "load_param_bin failed");
return JNI_FALSE;
}
}

// init bin
{
Expand All @@ -103,12 +91,27 @@ JNIEXPORT jboolean JNICALL Java_com_tencent_squeezencnn_SqueezeNcnn_Init(JNIEnv*
return JNI_FALSE;
}
}

// use vulkan compute
if (ncnn::get_gpu_count() != 0)
{
int ret = squeezenet_gpu.load_model(mgr, "squeezenet_v1.1.bin");
if (ret != 0)
squeezenet_gpu.opt.use_vulkan_compute = true;

{
__android_log_print(ANDROID_LOG_DEBUG, "SqueezeNcnn", "load_model failed");
return JNI_FALSE;
int ret = squeezenet_gpu.load_param_bin(mgr, "squeezenet_v1.1.param.bin");
if (ret != 0)
{
__android_log_print(ANDROID_LOG_DEBUG, "SqueezeNcnn", "load_param_bin failed");
return JNI_FALSE;
}
}
{
int ret = squeezenet_gpu.load_model(mgr, "squeezenet_v1.1.bin");
if (ret != 0)
{
__android_log_print(ANDROID_LOG_DEBUG, "SqueezeNcnn", "load_model failed");
return JNI_FALSE;
}
}
}

Expand Down

0 comments on commit 5a58f5c

Please sign in to comment.