Add functools32 to TensorFlow dependencies.

This library is a backport for Python 2 of the Python 3 functools standard library. We want to use functools.lru_cache for caching opt_einsum results.

One other option is adding backports/functools_lru_cache. But functools also has other components which might be useful.

PiperOrigin-RevId: 257299040
This commit is contained in:
Anudhyan Boral 2019-07-09 16:49:48 -07:00 committed by TensorFlower Gardener
parent e70b1dd882
commit 82c46d74d9
6 changed files with 34 additions and 0 deletions

View File

@ -212,6 +212,7 @@ tensorflow/third_party/nccl/BUILD
tensorflow/third_party/boringssl/BUILD
tensorflow/third_party/mpi/.gitignore
tensorflow/third_party/mpi/BUILD
tensorflow/third_party/functools32.BUILD
tensorflow/third_party/tensorrt/LICENSE
tensorflow/third_party/tensorrt/BUILD
tensorflow/third_party/tensorrt/build_defs.bzl.tpl

View File

@ -3555,6 +3555,7 @@ py_library(
":math_ops",
":platform",
"//tensorflow/compiler/tf2xla/ops:gen_xla_ops",
"@functools32_archive//:functools32",
"@opt_einsum_archive//:opt_einsum",
],
)

View File

@ -171,6 +171,7 @@ filegroup(
"@farmhash_archive//:COPYING",
"@fft2d//:fft2d/readme2d.txt",
"@flatbuffers//:LICENSE.txt",
"@functools32_archive//:LICENSE",
"@gast_archive//:PKG-INFO",
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",

View File

@ -88,6 +88,8 @@ else:
REQUIRED_PACKAGES.append('wheel')
# mock comes with unittest.mock for python3, need to install for python2
REQUIRED_PACKAGES.append('mock >= 2.0.0')
# functools comes with python3, need to install the backport for python2
REQUIRED_PACKAGES.append('functools32 >= 3.2.3')
# tf-nightly should depend on tb-nightly
if 'tf_nightly' in project_name:

View File

@ -316,6 +316,17 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
],
)
tf_http_archive(
name = "functools32_archive",
build_file = clean_dep("//third_party:functools32.BUILD"),
sha256 = "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d",
strip_prefix = "functools32-3.2.3-2",
urls = [
"http://mirror.tensorflow.org/pypi.python.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz",
"https://pypi.python.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz",
],
)
tf_http_archive(
name = "gast_archive",
build_file = clean_dep("//third_party:gast.BUILD"),

18
third_party/functools32.BUILD vendored Normal file
View File

@ -0,0 +1,18 @@
# Description:
# functools32 provides a backport of the functools module for Python 2.
licenses(["notice"]) # Python 2.0
exports_files(["LICENSE"])
py_library(
name = "functools32",
srcs = [
"functools32/__init__.py",
"functools32/_dummy_thread32.py",
"functools32/functools32.py",
"functools32/reprlib32.py",
],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)