Skip to content

Commit

Permalink
Clean up demo app and docs (#2685)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #2685

Reviewed By: shoumikhin

Differential Revision: D55357687

fbshipit-source-id: 7a004c88f46ce6efb9fe22add54eaa8dfb893ef9
  • Loading branch information
kirklandsign authored and facebook-github-bot committed Mar 26, 2024
1 parent acf5d83 commit 265a5e8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
9 changes: 0 additions & 9 deletions examples/demo-apps/android/ExecuTorchDemo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ cp deeplab_v3/dlv3_qnn.pte examples/demo-apps/android/ExecuTorchDemo/app/src/mai

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

#### Java helper classes

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.

```
mkdir -p examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor
cp extension/android/src/main/java/org/pytorch/executorch/*.java examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor
```

#### XNNPACK

1. Configure the CMake target for the library with XNNPACK backend:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha12")
implementation("com.facebook.soloader:soloader:0.10.5")
implementation("com.facebook.fbjni:fbjni:0.5.1")
implementation("org.pytorch.executorch:executorch") {
exclude("com.facebook.fbjni", "fbjni-java-only")
}
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.pytorch.executorch.EValue;
import org.pytorch.executorch.Module;
import org.pytorch.executorch.Tensor;
import org.pytorch.executorch.TensorImageUtils;

public class MainActivity extends Activity implements Runnable {
private ImageView mImageView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
* LICENSE file in the root directory of this source tree.
*/

package org.pytorch.executorch;
package com.example.executorchdemo;

import android.graphics.Bitmap;
import android.util.Log;
import java.nio.FloatBuffer;
import org.pytorch.executorch.Tensor;

/**
* Contains utility functions for {@link Tensor} creation from {@link android.graphics.Bitmap} or
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-apps/android/ExecuTorchDemo/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ dependencyResolutionManagement {
rootProject.name = "ExecuTorch Demo"

include(":app")

includeBuild("../../../../extension/android")
5 changes: 0 additions & 5 deletions examples/demo-apps/android/ExecuTorchDemo/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

set -eu

EXECUTOR_JAVA_DIR=examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/executor/
mkdir -p "${EXECUTOR_JAVA_DIR}"
# Temporary workaround until we have a formal Java package
cp extension/android/src/main/java/org/pytorch/executorch/*.java "${EXECUTOR_JAVA_DIR}"

pushd cmake-out
# Note: Set up ANDROID_NDK, ANDROID_ABI, BUCK2, and FLATC_EXECUTABLE
cmake .. -DCMAKE_INSTALL_PREFIX=cmake-out \
Expand Down

0 comments on commit 265a5e8

Please sign in to comment.