Skip to content

Commit 1a9769d

Browse files
asimshankartensorflower-gardener
authored andcommitted
contrib/android: Use the Java API to implement TensorFlowInferenceInterface
This removes the native code for tensorflow_inference_jni and makes it a pure Java class. Use of the Java API allows some "configuration" values (like the number of labels in the inception example) to be determined using shape inference instead of being passed in explicitly. Change: 147398845
1 parent 1b960c3 commit 1a9769d

File tree

12 files changed

+370
-878
lines changed

12 files changed

+370
-878
lines changed

tensorflow/contrib/android/README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
11
# Android TensorFlow support
22

3-
This directory contains components geared towards supporting TensorFlow on
4-
Android.
3+
This directory defines components (a native `.so` library and a Java JAR)
4+
geared towards supporting TensorFlow on Android. This includes:
55

6-
## Android Java Inference Interface for TensorFlow
6+
- The [TensorFlow Java API](../../java/README.md)
7+
- A `TensorFlowInferenceInterface` class that provides a smaller API
8+
surface suitable for inference and summarizing performance of model execution.
79

8-
This library contains a Java API capable of loading TensorFlow graphs and
9-
performing inference on Android. See [TensorFlowImageClassifier.java](../../examples/android/src/org/tensorflow/demo/TensorFlowImageClassifier.java)
10-
in the [TensorFlow Android Camera Demo](../../examples/android) for an example.
11-
12-
It also contains a Java class (`RunStats`) for summarizing performance
13-
of operations during graph execution.
14-
15-
With both the native .so library and the Java JAR (or AAR which combines both),
16-
you will have everything you need to use TensorFlow for inference in your
17-
Android app. Note that training is not supported through this interface; for
18-
that you will have to use one of the other APIs.
10+
For example usage, see [TensorFlowImageClassifier.java](../../examples/android/src/org/tensorflow/demo/TensorFlowImageClassifier.java)
11+
in the [TensorFlow Android Demo](../../examples/android).
1912

2013
For prebuilt libraries, see the
2114
[nightly Android build artifacts](https://ci.tensorflow.org/view/Nightly/job/nightly-android/)
2215
page for a recent build.
2316

24-
To build the inference libraries yourself (if, for example, you want to support
25-
custom TensorFlow operators), pick your preferred approach below:
17+
To build the libraries yourself (if, for example, you want to support custom
18+
TensorFlow operators), pick your preferred approach below:
2619

2720
### Bazel
2821

@@ -64,8 +57,9 @@ For documentation on building a self-contained AAR file with cmake, see
6457
[tensorflow/contrib/android/cmake](cmake).
6558

6659

67-
## AssetManagerFileSystem:
60+
## AssetManagerFileSystem
6861

69-
A TensorFlow filesystem supporting the Android asset manager. This may be
70-
useful when writing native (C/C++) code that is tightly coupled with TensorFlow
71-
(for typical usage the Inference Interface library above will be sufficient).
62+
This directory also contains a TensorFlow filesystem supporting the Android
63+
asset manager. This may be useful when writing native (C++) code that is tightly
64+
coupled with TensorFlow. For typical usage, the library above will be
65+
sufficient.

0 commit comments

Comments
 (0)