Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ To install the latest version, run the following:
```
pip install tensorflow-addons
```

**Note:** You will also need [TensorFlow 2.0 or higher](https://www.tensorflow.org/alpha).
**Note:** You will also need [`tensorflow==2.0.0.a0`](https://www.tensorflow.org/alpha) installed.

To use addons:

Expand All @@ -76,6 +76,8 @@ import tensorflow_addons as tfa
You can also install from source. This requires the [Bazel](
https://bazel.build/) build system.

**Note:** If building from master you must install `tf-nightly-2.0-preview` in the process.

```
git clone https://github.com/tensorflow/addons.git
cd addons
Expand Down
2 changes: 2 additions & 0 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pip install $QUIET_FLAG -r requirements.txt

TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )
TF_SHAREDLIB=( $(python -c 'import tensorflow as tf; print(tf.sysconfig.get_link_flags()[-1])') )

write_action_env_to_bazelrc "TF_HEADER_DIR" ${TF_CFLAGS:2}
write_action_env_to_bazelrc "TF_SHARED_LIBRARY_DIR" ${TF_LFLAGS:2}
write_action_env_to_bazelrc "TF_SHARED_LIBRARY_NAME" ${TF_SHAREDLIB:3}
6 changes: 1 addition & 5 deletions tf_dependency/BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ cc_library(
visibility = ["//visibility:public"],
)

# FIXME: Read shared library name from the installed python package.
# See https://github.com/tensorflow/tensorflow/issues/27430 for why we're
# linking with hardcoded framework.so.2

cc_library(
name = "libtensorflow_framework",
srcs = [":libtensorflow_framework.so.2"],
#data = ["lib/libtensorflow_framework.so.2"],
srcs = ["%{TF_SHARED_LIBRARY_NAME}"],
visibility = ["//visibility:public"],
)

Expand Down
11 changes: 8 additions & 3 deletions tf_dependency/tf_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ _TF_HEADER_DIR = "TF_HEADER_DIR"

_TF_SHARED_LIBRARY_DIR = "TF_SHARED_LIBRARY_DIR"

_TF_SHARED_LIBRARY_NAME = "TF_SHARED_LIBRARY_NAME"

def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
if not out:
out = tpl
Expand Down Expand Up @@ -183,19 +185,22 @@ def _tf_pip_impl(repository_ctx):
)

tf_shared_library_dir = repository_ctx.os.environ[_TF_SHARED_LIBRARY_DIR]
tf_shared_library_path = "%s/libtensorflow_framework.so.2" % tf_shared_library_dir
tf_shared_library_name = repository_ctx.os.environ[_TF_SHARED_LIBRARY_NAME]
tf_shared_library_path = "%s/%s" % (tf_shared_library_dir, tf_shared_library_name)

tf_shared_library_rule = _symlink_genrule_for_dir(
repository_ctx,
None,
"",
"libtensorflow_framework.so.2",
tf_shared_library_name,
[tf_shared_library_path],
["libtensorflow_framework.so.2"],
[tf_shared_library_name],
)

_tpl(repository_ctx, "BUILD", {
"%{TF_HEADER_GENRULE}": tf_header_rule,
"%{TF_SHARED_LIBRARY_GENRULE}": tf_shared_library_rule,
"%{TF_SHARED_LIBRARY_NAME}": tf_shared_library_name,
})

tf_configure = repository_rule(
Expand Down