aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Manjunath Kudlur <keveman@gmail.com>2016-02-26 13:16:46 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-02-26 13:23:31 -0800
commitf417134a5a41a9fc4ab0161c9215633f3c4c0156 (patch)
tree794bcb363e63e5aeabcbea44b14fe39f34b3fe75
parent96118731cb793f0d51adfb7a4df058ee3c5fa00a (diff)
Copy protobuf header files and Eigen to the pip package.
Clarify the documentation on how to build using bazel. Fixes #1270. Change: 115701645
-rw-r--r--tensorflow/g3doc/how_tos/adding_an_op/index.md10
-rwxr-xr-xtensorflow/tools/pip_package/build_pip_package.sh10
2 files changed, 16 insertions, 4 deletions
diff --git a/tensorflow/g3doc/how_tos/adding_an_op/index.md b/tensorflow/g3doc/how_tos/adding_an_op/index.md
index 38f232104f..7e9e36373c 100644
--- a/tensorflow/g3doc/how_tos/adding_an_op/index.md
+++ b/tensorflow/g3doc/how_tos/adding_an_op/index.md
@@ -145,8 +145,8 @@ $ g++ -std=c++11 -shared zero_out.cc -o zero_out.so \
### With TensorFlow source installation
If you have TensorFlow sources installed, you can make use of TensorFlow's build
-system to compile your Op. The following Bazel build rule would build
-`zero_out.so`.
+system to compile your Op. Place a BUILD file with following Bazel build rule in
+the [`tensorflow/core/user_ops`][user_ops] directory.
```python
cc_binary(
@@ -164,6 +164,12 @@ cc_binary(
)
```
+Run the following command to build `zero_out.so`.
+
+```bash
+$ bazel build -c opt //tensorflow/core/user_ops:zero_out.so
+```
+
## Using the Op in Python
TensorFlow Python API provides the
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
index edf7d9aba3..6b4e50490b 100755
--- a/tensorflow/tools/pip_package/build_pip_package.sh
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -35,8 +35,14 @@ function main() {
cp -R \
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/{tensorflow,external} \
${TMPDIR}
- # TODO: We should have cleaner solution for this after 0.7 release
- rm -rf ${TMPDIR}/external/eigen_archive
+ # protobuf pip package doesn't ship with header files. Copy the headers
+ # over so user defined ops can be compiled.
+ rsync --include "*/" --include "*.h" --exclude "*" --prune-empty-dirs -a \
+ bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/google \
+ ${TMPDIR}
+ rsync -a \
+ bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/third_party/eigen3 \
+ ${TMPDIR}/third_party
cp tensorflow/tools/pip_package/MANIFEST.in ${TMPDIR}
cp tensorflow/tools/pip_package/README ${TMPDIR}