Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android support for TensorFlow presets #297

Merged
merged 18 commits into from
Oct 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e3a9252
Added patch for tensorflow android and adapted cppbuild.sh
andreas-eberle Sep 30, 2016
545ef79
Added platform android to presets/tensorflow.java
andreas-eberle Oct 1, 2016
3b1b04c
Merge branch 'master' into tensorflow-android
andreas-eberle Oct 1, 2016
cd26450
Removing headers and methods not usable on Android
andreas-eberle Oct 6, 2016
1a7ba31
Removing two duplicate headers and dot.h
andreas-eberle Oct 7, 2016
07e2d86
Skipping some definitions.
andreas-eberle Oct 8, 2016
78cf8f3
Added missing skip configuration.
andreas-eberle Oct 8, 2016
7cdc606
Added missing floor kernel required by dropout layers.
andreas-eberle Oct 8, 2016
61d40bf
Using sed to correctly set the NDK path in tensorflow's WORKSPACE file.
andreas-eberle Oct 8, 2016
75e6c45
Added c_api to Android build.
andreas-eberle Oct 8, 2016
bfda8a8
Adding back in most of the removed configurations needed for linux an…
andreas-eberle Oct 8, 2016
b3a5c83
Adding @Platform(not="android") for OpDefBuilderWrapper definitions w…
andreas-eberle Oct 10, 2016
076cd97
Added back in the macosx and linux headers.
andreas-eberle Oct 10, 2016
09f585b
Removing orphaned RegisterOps declaration (see https://github.com/ten…
andreas-eberle Oct 10, 2016
9115ff4
Including OpDefBuilder::Doc in tensorflow build.
andreas-eberle Oct 10, 2016
30c28a6
Merge branch 'master' into tensorflow-android
andreas-eberle Oct 11, 2016
1417f62
Merge branch 'master' into tensorflow-android
andreas-eberle Oct 12, 2016
60253e4
Exchange tabs with spaces.
andreas-eberle Oct 12, 2016
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
30 changes: 19 additions & 11 deletions tensorflow/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@ export CUDA_TOOLKIT_PATH=/usr/local/cuda
export CUDNN_INSTALL_PATH=$CUDA_TOOLKIT_PATH
export TF_CUDA_COMPUTE_CAPABILITIES=3.0

TENSORFLOW_VERSION=0.10.0

download https://github.com/tensorflow/tensorflow/archive/v$TENSORFLOW_VERSION.tar.gz tensorflow-$TENSORFLOW_VERSION.tar.gz

mkdir -p $PLATFORM
cd $PLATFORM

echo "Decompressing archives"
tar --totals -xzf ../tensorflow-$TENSORFLOW_VERSION.tar.gz

# Assumes Bazel is available in the path: http://bazel.io/docs/install.html
cd tensorflow-$TENSORFLOW_VERSION


case $PLATFORM in
android-arm)
patch -Np1 < ../../../tensorflow-$TENSORFLOW_VERSION-android.patch
sed -i "/ path=\"<PATH_TO_NDK>\",/c\ path=\"${ANDROID_NDK}\"," ./WORKSPACE
export BUILDFLAGS="--crosstool_top=//external:android/crosstool --cpu=armeabi-v7a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain"
;;
linux-x86)
export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"
Expand All @@ -40,17 +59,6 @@ case $PLATFORM in
;;
esac

TENSORFLOW_VERSION=0.10.0
download https://github.com/tensorflow/tensorflow/archive/v$TENSORFLOW_VERSION.tar.gz tensorflow-$TENSORFLOW_VERSION.tar.gz

mkdir -p $PLATFORM
cd $PLATFORM

echo "Decompressing archives"
tar --totals -xzf ../tensorflow-$TENSORFLOW_VERSION.tar.gz

# Assumes Bazel is available in the path: http://bazel.io/docs/install.html
cd tensorflow-$TENSORFLOW_VERSION
./configure
bazel build -c opt //tensorflow:libtensorflow_cc.so $BUILDFLAGS --spawn_strategy=standalone --genrule_strategy=standalone --verbose_failures

Expand Down
234 changes: 147 additions & 87 deletions tensorflow/src/main/java/org/bytedeco/javacpp/presets/tensorflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,93 +46,153 @@
*
* @author Samuel Audet
*/
@Properties(value = @Platform(
value = {"linux-x86", "macosx"},
compiler = "cpp11",
define = {"NDEBUG", "UNIQUE_PTR_NAMESPACE std"},
include = {
"tensorflow/core/platform/default/integral_types.h",
"tensorflow/core/framework/numeric_types.h",
"tensorflow/core/platform/init_main.h",
"tensorflow/core/platform/types.h",
"tensorflow/core/platform/mutex.h",
"tensorflow/core/platform/macros.h",
"tensorflow/core/util/port.h",
"tensorflow/core/lib/core/error_codes.pb.h",
"tensorflow/core/platform/logging.h",
"tensorflow/core/lib/core/status.h",
"tensorflow/core/platform/protobuf.h",
"tensorflow/core/platform/file_system.h",
"tensorflow/core/platform/file_statistics.h",
"tensorflow/core/platform/env.h",
"tensorflow/core/graph/dot.h",
"tensorflow/core/protobuf/config.pb.h",
"tensorflow/core/framework/cost_graph.pb.h",
"tensorflow/core/framework/step_stats.pb.h",
"tensorflow/core/framework/versions.pb.h",
"tensorflow/core/public/session_options.h",
"tensorflow/core/lib/core/threadpool.h",
"tensorflow/core/framework/allocation_description.pb.h",
"tensorflow/core/framework/allocator.h",
"tensorflow/core/framework/tensor_shape.pb.h",
"tensorflow/core/framework/types.pb.h",
"tensorflow/core/framework/tensor.pb.h",
"tensorflow/core/framework/tensor_description.pb.h",
"tensorflow/core/framework/tensor_types.h",
"tensorflow/core/framework/tensor_shape.h",
// "tensorflow/core/framework/tensor_slice.h",
"tensorflow/core/framework/tensor_util.h",
"tensorflow/core/framework/tensor_reference.h",
"tensorflow/core/framework/tensor.h",
"tensorflow/core/framework/attr_value.pb.h",
"tensorflow/core/framework/op_def.pb.h",
"tensorflow/core/framework/function.pb.h",
"tensorflow/core/framework/graph.pb.h",
"tensorflow/core/framework/shape_inference.h",
"tensorflow/core/framework/partial_tensor_shape.h",
"tensorflow/core/public/session.h",
"tensorflow/c/c_api.h",
"tensorflow/core/framework/op_def.pb.h",
"tensorflow/core/framework/op_def_builder.h",
"tensorflow/core/framework/op_def_util.h",
"tensorflow/core/framework/op.h",
"tensorflow/core/framework/types.h",
"tensorflow/core/graph/edgeset.h",
"tensorflow/core/lib/gtl/iterator_range.h",
// "tensorflow/core/lib/gtl/inlined_vector.h",
"tensorflow/core/graph/graph.h",
"tensorflow/core/framework/node_def_builder.h",
"tensorflow/core/framework/node_def_util.h",
"tensorflow/core/framework/selective_registration.h",
"tensorflow/core/graph/node_builder.h",
"tensorflow/core/graph/graph_def_builder.h",
"tensorflow/core/graph/default_device.h",
"tensorflow/core/graph/graph_constructor.h",
"tensorflow/cc/framework/scope.h",
"tensorflow/cc/framework/ops.h",
"tensorflow/cc/framework/cc_op_gen.h",
"tensorflow_adapters.h",
"tensorflow/cc/ops/standard_ops.h",
"tensorflow/cc/ops/const_op.h",
"tensorflow/cc/ops/array_ops.h",
"tensorflow/cc/ops/candidate_sampling_ops.h",
"tensorflow/cc/ops/control_flow_ops.h",
"tensorflow/cc/ops/data_flow_ops.h",
"tensorflow/cc/ops/image_ops.h",
"tensorflow/cc/ops/io_ops.h",
"tensorflow/cc/ops/linalg_ops.h",
"tensorflow/cc/ops/logging_ops.h",
"tensorflow/cc/ops/math_ops.h",
"tensorflow/cc/ops/nn_ops.h",
"tensorflow/cc/ops/no_op.h",
"tensorflow/cc/ops/parsing_ops.h",
"tensorflow/cc/ops/random_ops.h",
"tensorflow/cc/ops/sparse_ops.h",
"tensorflow/cc/ops/state_ops.h",
"tensorflow/cc/ops/string_ops.h",
"tensorflow/cc/ops/training_ops.h",
"tensorflow/cc/ops/user_ops.h"},
link = "tensorflow_cc"),
@Properties(value = {
@Platform(
value = {"linux-x86", "macosx"},
compiler = "cpp11",
define = {"NDEBUG", "UNIQUE_PTR_NAMESPACE std"},
include = {
"tensorflow/core/platform/default/integral_types.h",
"tensorflow/core/framework/numeric_types.h",
"tensorflow/core/platform/init_main.h",
"tensorflow/core/platform/types.h",
"tensorflow/core/platform/mutex.h",
"tensorflow/core/platform/macros.h",
"tensorflow/core/util/port.h",
"tensorflow/core/lib/core/error_codes.pb.h",
"tensorflow/core/platform/logging.h",
"tensorflow/core/lib/core/status.h",
"tensorflow/core/platform/protobuf.h",
"tensorflow/core/platform/file_system.h",
"tensorflow/core/platform/file_statistics.h",
"tensorflow/core/platform/env.h",
"tensorflow/core/graph/dot.h",
"tensorflow/core/protobuf/config.pb.h",
"tensorflow/core/framework/cost_graph.pb.h",
"tensorflow/core/framework/step_stats.pb.h",
"tensorflow/core/framework/versions.pb.h",
"tensorflow/core/public/session_options.h",
"tensorflow/core/lib/core/threadpool.h",
"tensorflow/core/framework/allocation_description.pb.h",
"tensorflow/core/framework/allocator.h",
"tensorflow/core/framework/tensor_shape.pb.h",
"tensorflow/core/framework/types.pb.h",
"tensorflow/core/framework/tensor.pb.h",
"tensorflow/core/framework/tensor_description.pb.h",
"tensorflow/core/framework/tensor_types.h",
"tensorflow/core/framework/tensor_shape.h",
// "tensorflow/core/framework/tensor_slice.h",
"tensorflow/core/framework/tensor_util.h",
"tensorflow/core/framework/tensor_reference.h",
"tensorflow/core/framework/tensor.h",
"tensorflow/core/framework/attr_value.pb.h",
"tensorflow/core/framework/op_def.pb.h",
"tensorflow/core/framework/function.pb.h",
"tensorflow/core/framework/graph.pb.h",
"tensorflow/core/framework/shape_inference.h",
"tensorflow/core/framework/partial_tensor_shape.h",
"tensorflow/core/public/session.h",
"tensorflow/c/c_api.h",
"tensorflow/core/framework/op_def.pb.h",
"tensorflow/core/framework/op_def_builder.h",
"tensorflow/core/framework/op_def_util.h",
"tensorflow/core/framework/op.h",
"tensorflow/core/framework/types.h",
"tensorflow/core/graph/edgeset.h",
"tensorflow/core/lib/gtl/iterator_range.h",
// "tensorflow/core/lib/gtl/inlined_vector.h",
"tensorflow/core/graph/graph.h",
"tensorflow/core/framework/node_def_builder.h",
"tensorflow/core/framework/node_def_util.h",
"tensorflow/core/framework/selective_registration.h",
"tensorflow/core/graph/node_builder.h",
"tensorflow/core/graph/graph_def_builder.h",
"tensorflow/core/graph/default_device.h",
"tensorflow/core/graph/graph_constructor.h",
"tensorflow/cc/framework/scope.h",
"tensorflow/cc/framework/ops.h",
"tensorflow/cc/framework/cc_op_gen.h",
"tensorflow_adapters.h",
"tensorflow/cc/ops/standard_ops.h",
"tensorflow/cc/ops/const_op.h",
"tensorflow/cc/ops/array_ops.h",
"tensorflow/cc/ops/candidate_sampling_ops.h",
"tensorflow/cc/ops/control_flow_ops.h",
"tensorflow/cc/ops/data_flow_ops.h",
"tensorflow/cc/ops/image_ops.h",
"tensorflow/cc/ops/io_ops.h",
"tensorflow/cc/ops/linalg_ops.h",
"tensorflow/cc/ops/logging_ops.h",
"tensorflow/cc/ops/math_ops.h",
"tensorflow/cc/ops/nn_ops.h",
"tensorflow/cc/ops/no_op.h",
"tensorflow/cc/ops/parsing_ops.h",
"tensorflow/cc/ops/random_ops.h",
"tensorflow/cc/ops/sparse_ops.h",
"tensorflow/cc/ops/state_ops.h",
"tensorflow/cc/ops/string_ops.h",
"tensorflow/cc/ops/training_ops.h",
"tensorflow/cc/ops/user_ops.h"},
link = "tensorflow_cc"),
@Platform(value = {"android"},
compiler = {"cpp11"},
define = {"NDEBUG", "UNIQUE_PTR_NAMESPACE std"},
include = {
"tensorflow/core/platform/default/integral_types.h",
"tensorflow/core/framework/numeric_types.h",
"tensorflow/core/platform/init_main.h",
"tensorflow/core/platform/types.h",
"tensorflow/core/platform/mutex.h",
"tensorflow/core/platform/macros.h",
"tensorflow/core/util/port.h",
"tensorflow/core/lib/core/error_codes.pb.h",
"tensorflow/core/platform/logging.h",
"tensorflow/core/lib/core/status.h",
"tensorflow/core/platform/protobuf.h",
"tensorflow/core/platform/file_system.h",
"tensorflow/core/platform/file_statistics.h",
"tensorflow/core/platform/env.h",
"tensorflow/core/protobuf/config.pb.h",
"tensorflow/core/framework/cost_graph.pb.h",
"tensorflow/core/framework/step_stats.pb.h",
"tensorflow/core/framework/versions.pb.h",
"tensorflow/core/public/session_options.h",
"tensorflow/core/lib/core/threadpool.h",
"tensorflow/core/framework/allocation_description.pb.h",
"tensorflow/core/framework/allocator.h",
"tensorflow/core/framework/tensor_shape.pb.h",
"tensorflow/core/framework/types.pb.h",
"tensorflow/core/framework/tensor.pb.h",
"tensorflow/core/framework/tensor_description.pb.h",
"tensorflow/core/framework/tensor_types.h",
"tensorflow/core/framework/tensor_shape.h",
"tensorflow/core/framework/tensor_util.h",
"tensorflow/core/framework/tensor_reference.h",
"tensorflow/core/framework/tensor.h",
"tensorflow/core/framework/attr_value.pb.h",
"tensorflow/core/framework/function.pb.h",
"tensorflow/core/framework/graph.pb.h",
"tensorflow/core/framework/shape_inference.h",
"tensorflow/core/framework/partial_tensor_shape.h",
"tensorflow/core/public/session.h",
"tensorflow/c/c_api.h",
"tensorflow/core/framework/op_def.pb.h",
"tensorflow/core/framework/op_def_builder.h",
"tensorflow/core/framework/op_def_util.h",
"tensorflow/core/framework/op.h",
"tensorflow/core/framework/types.h",
"tensorflow/core/graph/edgeset.h",
"tensorflow/core/lib/gtl/iterator_range.h",
"tensorflow/core/graph/graph.h",
"tensorflow/core/framework/node_def_builder.h",
"tensorflow/core/framework/node_def_util.h",
"tensorflow/core/graph/node_builder.h",
"tensorflow/core/graph/graph_def_builder.h",
"tensorflow/core/graph/default_device.h",
"tensorflow/core/graph/graph_constructor.h",
"tensorflow_adapters.h"},
link = "tensorflow_cc"),
},
target = "org.bytedeco.javacpp.tensorflow",
helper = "org.bytedeco.javacpp.helper.tensorflow")
public class tensorflow implements InfoMapper {
Expand Down
Loading