Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="com.example.executorchdemo">

<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="34"
android:maxSdkVersion="40" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:allowBackup="true"
Expand All @@ -15,7 +19,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.ExecuTorchDemo"
android:extractNativeLibs="true"
tools:targetApi="31">
tools:targetApi="34">

<uses-native-library android:name="libexecutorchdemo.so"
android:required="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.executorchdemo.executor.EValue;
import com.example.executorchdemo.executor.Module;
import com.example.executorchdemo.executor.Tensor;
import com.example.executorchdemo.executor.TensorImageUtils;
import java.io.IOException;
import org.pytorch.executorch.EValue;
import org.pytorch.executorch.Module;
import org.pytorch.executorch.Tensor;
import org.pytorch.executorch.TensorImageUtils;

public class ClassificationActivity extends Activity implements Runnable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.example.executorchdemo.executor.EValue;
import com.example.executorchdemo.executor.Module;
import com.example.executorchdemo.executor.Tensor;
import com.example.executorchdemo.executor.TensorImageUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Objects;
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 @@ -7,4 +7,4 @@
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/

package org.pytorch.executorch;

/** Codes representing tensor data types. */
public enum DType {
// NOTE: "jniCode" must be kept in sync with scalar_type.h.
// NOTE: Never serialize "jniCode", because it can change between releases.

/** Code for dtype torch::executor::Byte */
UINT8(0),
/** Code for dtype torch::executor::Char */
INT8(1),
/** Code for dtype torch::executor::Short */
INT16(2),
/** Code for dtype torch::executor::Int */
INT32(3),
/** Code for dtype torch::executor::Long */
INT64(4),
/** Code for dtype torch::executor::Half */
HALF(5),
/** Code for dtype torch::executor::Float */
FLOAT(6),
/** Code for dtype torch::executor::Double */
DOUBLE(7),
/** Code for dtype torch::executor::ComplexHalf */
COMPLEX_HALF(8),
/** Code for dtype torch::executor::ComplexFloat */
COMPLEX_FLOAT(9),
/** Code for dtype torch::executor::ComplexDouble */
COMPLEX_DOUBLE(10),
/** Code for dtype torch::executor::Bool */
BOOL(11),
/** Code for dtype torch::executor::QInt8 */
QINT8(12),
/** Code for dtype torch::executor::QUInt8 */
QUINT8(13),
/** Code for dtype torch::executor::QInt32 */
QINT32(14),
/** Code for dtype torch::executor::BFloat16 */
BFLOAT16(15),
/** Code for dtype torch::executor::QUInt4x2 */
QINT4X2(16),
/** Code for dtype torch::executor::QUInt2x4 */
QINT2X4(17),
/** Code for dtype torch::executor::Bits1x8 */
BITS1X8(18),
/** Code for dtype torch::executor::Bits2x4 */
BITS2X4(19),
/** Code for dtype torch::executor::Bits4x2 */
BITS4X2(20),
/** Code for dtype torch::executor::Bits8 */
BITS8(21),
/** Code for dtype torch::executor::Bits16 */
BITS16(22),
;

final int jniCode;

DType(int jniCode) {
this.jniCode = jniCode;
}
}
Loading