Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JNI interop for allowBufferHandleOutput #28489

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -122,6 +122,15 @@ JNIEXPORT void JNICALL
Java_org_tensorflow_lite_NativeInterpreterWrapper_allowFp16PrecisionForFp32(
JNIEnv* env, jclass clazz, jlong handle, jboolean allow);

/*
* Class: org_tensorflow_lite_NativeInterpreterWrapper
* Method:
* Signature: (JZ)V
*/
JNIEXPORT void JNICALL
Java_org_tensorflow_lite_NativeInterpreterWrapper_allowBufferHandleOutput(
JNIEnv* env, jclass clazz, jlong handle, jboolean allow);

/*
* Class: org_tensorflow_lite_NativeInterpreterWrapper
* Method:
Expand Down
Expand Up @@ -61,7 +61,13 @@ public void testInterpreter() throws Exception {
@Test
public void testInterpreterWithOptions() throws Exception {
Interpreter interpreter =
new Interpreter(MODEL_FILE, new Interpreter.Options().setNumThreads(2).setUseNNAPI(true));
new Interpreter(
MODEL_FILE,
new Interpreter.Options()
.setNumThreads(2)
.setUseNNAPI(true)
.setAllowFp16PrecisionForFp32(false)
.setAllowBufferHandleOutput(false));
assertThat(interpreter).isNotNull();
assertThat(interpreter.getInputTensorCount()).isEqualTo(1);
assertThat(interpreter.getInputTensor(0).dataType()).isEqualTo(DataType.FLOAT32);
Expand Down