Skip to content

Commit

Permalink
* Enable Python API for TensorFlow build with Bazel (issue #602)
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Aug 18, 2018
1 parent 908801e commit 6f847c3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Bundle native resources (header files and import libraries) of MKL-DNN
* Make MSBuild compile more efficiently on multiple processors ([pull #599](https://github.com/bytedeco/javacpp-presets/pull/599))
* Add samples for Clang ([pull #598](https://github.com/bytedeco/javacpp-presets/pull/598))
* Include `python_api.h` for TensorFlow ([issue #585](https://github.com/bytedeco/javacpp-presets/issues/585))
* Include `python_api.h` and enable Python API for TensorFlow ([issue #602](https://github.com/bytedeco/javacpp-presets/issues/602))
* Add presets for ONNX 1.2.2 ([pull #547](https://github.com/bytedeco/javacpp-presets/pull/547))
* Define `std::vector<tensorflow::OpDef>` type to `OpDefVector` for TensorFlow
* Link HDF5 with zlib on Windows also ([issue deeplearning4j/deeplearning4j#6017](https://github.com/deeplearning4j/deeplearning4j/issues/6017))
Expand Down
40 changes: 29 additions & 11 deletions tensorflow/tensorflow-java.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -ruN tensorflow-1.9.0-rc2/tensorflow/BUILD tensorflow-1.9.0-rc2-java/tensorflow/BUILD
--- tensorflow-1.9.0-rc2/tensorflow/BUILD 2018-07-03 07:07:51.000000000 +0900
+++ tensorflow-1.9.0-rc2-java/tensorflow/BUILD 2018-07-05 10:07:19.120647307 +0900
@@ -530,16 +530,12 @@
diff -ruN tensorflow-1.10.0/tensorflow/BUILD tensorflow-1.10.0-java/tensorflow/BUILD
--- tensorflow-1.10.0/tensorflow/BUILD 2018-08-08 08:52:04.000000000 +0900
+++ tensorflow-1.10.0-java/tensorflow/BUILD 2018-08-18 07:19:00.002529204 +0900
@@ -546,28 +546,26 @@
tf_cc_shared_object(
name = "libtensorflow_cc.so",
linkopts = select({
Expand All @@ -20,17 +20,35 @@ diff -ruN tensorflow-1.9.0-rc2/tensorflow/BUILD tensorflow-1.9.0-rc2-java/tensor
],
}),
deps = [
@@ -552,6 +548,7 @@
"//tensorflow:tf_exported_symbols.lds",
"//tensorflow:tf_version_script.lds",
"//tensorflow/c:c_api",
+ "//tensorflow/c:python_api",
"//tensorflow/c/eager:c_api",
"//tensorflow/cc:cc_ops",
"//tensorflow/cc:client_session",
"//tensorflow/cc:scope",
"//tensorflow/cc/profiler",
"//tensorflow/core:tensorflow",
+ "//tensorflow/java/src/main/native:native",
],
)

diff -ruN tensorflow-1.9.0-rc2/tensorflow/core/framework/tensor.h tensorflow-1.9.0-rc2-java/tensorflow/core/framework/tensor.h
--- tensorflow-1.9.0-rc2/tensorflow/core/framework/tensor.h 2018-07-03 07:07:51.000000000 +0900
+++ tensorflow-1.9.0-rc2-java/tensorflow/core/framework/tensor.h 2018-07-05 10:08:00.520657265 +0900
diff -ruN tensorflow-1.10.0/tensorflow/c/BUILD tensorflow-1.10.0-java/tensorflow/c/BUILD
--- tensorflow-1.10.0/tensorflow/c/BUILD 2018-08-08 08:52:04.000000000 +0900
+++ tensorflow-1.10.0-java/tensorflow/c/BUILD 2018-08-18 07:22:56.651480681 +0900
@@ -280,7 +280,7 @@
name = "python_api",
srcs = ["python_api.cc"],
hdrs = ["python_api.h"],
- visibility = ["//tensorflow/python:__pkg__"],
+ visibility = ["//visibility:public"],
deps = [
":c_api",
":c_api_internal",
diff -ruN tensorflow-1.10.0/tensorflow/core/framework/tensor.h tensorflow-1.10.0-java/tensorflow/core/framework/tensor.h
--- tensorflow-1.10.0/tensorflow/core/framework/tensor.h 2018-08-08 08:52:04.000000000 +0900
+++ tensorflow-1.10.0-java/tensorflow/core/framework/tensor.h 2018-08-18 07:18:37.783538856 +0900
@@ -117,6 +117,11 @@
/// are not valid.
Tensor(Tensor&& other);
Expand All @@ -55,9 +73,9 @@ diff -ruN tensorflow-1.9.0-rc2/tensorflow/core/framework/tensor.h tensorflow-1.9
bool CanUseDMA() const;

// Only needed by variable op to set the shape of an uninitialized
diff -ruN tensorflow-1.9.0-rc2/tensorflow/java/src/main/native/BUILD tensorflow-1.9.0-rc2-java/tensorflow/java/src/main/native/BUILD
--- tensorflow-1.9.0-rc2/tensorflow/java/src/main/native/BUILD 2018-07-03 07:07:51.000000000 +0900
+++ tensorflow-1.9.0-rc2-java/tensorflow/java/src/main/native/BUILD 2018-07-05 10:07:19.121647307 +0900
diff -ruN tensorflow-1.10.0/tensorflow/java/src/main/native/BUILD tensorflow-1.10.0-java/tensorflow/java/src/main/native/BUILD
--- tensorflow-1.10.0/tensorflow/java/src/main/native/BUILD 2018-08-08 08:52:04.000000000 +0900
+++ tensorflow-1.10.0-java/tensorflow/java/src/main/native/BUILD 2018-08-18 07:18:37.784538856 +0900
@@ -29,6 +29,7 @@
}),
hdrs = glob(["*.h"]),
Expand Down

0 comments on commit 6f847c3

Please sign in to comment.