Skip to content

Commit 4ebb2d9

Browse files
kirklandsignfacebook-github-bot
authored andcommitted
Clean up demo app and docs (#2685)
Summary: Pull Request resolved: #2685 Differential Revision: D55357687
1 parent 2e42b23 commit 4ebb2d9

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

examples/demo-apps/android/ExecuTorchDemo/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ cp deeplab_v3/dlv3_qnn.pte examples/demo-apps/android/ExecuTorchDemo/app/src/mai
6262

6363
We build the required ExecuTorch runtime library to run the model.
6464

65-
#### Java helper classes
66-
67-
Note: This is an ad-hoc solution. We will publish a formal Java package when it is ready. However, for now we need to copy sources from extension/android/src/main/java/org/pytorch/executorch.
68-
69-
```
70-
mkdir -p examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor
71-
cp extension/android/src/main/java/org/pytorch/executorch/*.java examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor
72-
```
73-
7465
#### XNNPACK
7566

7667
1. Configure the CMake target for the library with XNNPACK backend:

examples/demo-apps/android/ExecuTorchDemo/app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ dependencies {
5757
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha12")
5858
implementation("com.facebook.soloader:soloader:0.10.5")
5959
implementation("com.facebook.fbjni:fbjni:0.5.1")
60+
implementation("org.pytorch.executorch:executorch") {
61+
exclude("com.facebook.fbjni", "fbjni-java-only")
62+
}
6063
testImplementation("junit:junit:4.13.2")
6164
androidTestImplementation("androidx.test.ext:junit:1.1.5")
6265
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")

examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/MainActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.pytorch.executorch.EValue;
3131
import org.pytorch.executorch.Module;
3232
import org.pytorch.executorch.Tensor;
33-
import org.pytorch.executorch.TensorImageUtils;
3433

3534
public class MainActivity extends Activity implements Runnable {
3635
private ImageView mImageView;

extension/android/src/main/java/org/pytorch/executorch/TensorImageUtils.java renamed to examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/TensorImageUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
package org.pytorch.executorch;
9+
package com.example.executorchdemo;
1010

1111
import android.graphics.Bitmap;
1212
import android.util.Log;
1313
import java.nio.FloatBuffer;
14+
import org.pytorch.executorch.Tensor;
1415

1516
/**
1617
* Contains utility functions for {@link Tensor} creation from {@link android.graphics.Bitmap} or

examples/demo-apps/android/ExecuTorchDemo/settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ dependencyResolutionManagement {
2525
rootProject.name = "ExecuTorch Demo"
2626

2727
include(":app")
28+
29+
includeBuild("../../../../extension/android")

examples/demo-apps/android/ExecuTorchDemo/setup.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
set -eu
1010

11-
EXECUTOR_JAVA_DIR=examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor/
12-
mkdir -p "${EXECUTOR_JAVA_DIR}"
13-
# Temporary workaround until we have a formal Java package
14-
cp extension/android/src/main/java/org/pytorch/executorch/*.java "${EXECUTOR_JAVA_DIR}"
15-
1611
pushd cmake-out
1712
# Note: Set up ANDROID_NDK, ANDROID_ABI, BUCK2, and FLATC_EXECUTABLE
1813
cmake .. -DCMAKE_INSTALL_PREFIX=cmake-out \

0 commit comments

Comments
 (0)