-->

Build an android app using Tensorflow

2019-09-14 21:50发布

问题:

I'd like to separate the TensorFlow Android Camera Demo from the repo of Tensorflow.

Is there a way to do that without changing anything to the tensorflow repo ?

The final structure should be something like this:

my_project
|-- WORKSPACE
|-- my_android_app
|   |-- BUILD
|   `-- ...
|-- tensorflow
|   |-- tensorflow
|   |   |   |-- workspace.bzl
|   |   |   |-- tensorflow.bzl
|   |   |   `-- ...
|   |-- WORKSPACE
|   |-- BUILD
.    `-- ...

In other words, how to import Tensorflow repo as a package in bazel ?

回答1:

If you want to literally copy the directory into your my_project directory, you can. Then add the following lines to your my_project/WORKSPACE file:

 local_repository(
     name = "my_tensorflow",
     path = "./tensorflow", # Relative path to the tensorflow workspace
 )

Then you can depend on any targets from tensorflow in your project, e.g., @my_tensorflow//tensorflow:workspace.bzl.

Take a look at Tensorflow's "serving" project, which does what it looks like you're trying to do: https://github.com/tensorflow/serving/blob/master/WORKSPACE.