diff --git a/tensorflow/opensource_only.files b/tensorflow/opensource_only.files index f598b4bd5b0..fdb57b9f93c 100644 --- a/tensorflow/opensource_only.files +++ b/tensorflow/opensource_only.files @@ -144,6 +144,7 @@ tensorflow/third_party/systemlibs/BUILD tensorflow/third_party/systemlibs/google_cloud_cpp.BUILD tensorflow/third_party/systemlibs/astor.BUILD tensorflow/third_party/systemlibs/six.BUILD +tensorflow/third_party/systemlibs/opt_einsum.BUILD tensorflow/third_party/systemlibs/absl_py.absl.testing.BUILD tensorflow/third_party/systemlibs/boringssl.BUILD tensorflow/third_party/systemlibs/nsync.BUILD @@ -214,6 +215,7 @@ tensorflow/third_party/mkl_dnn/LICENSE tensorflow/third_party/mkl_dnn/mkldnn.BUILD tensorflow/third_party/pcre.BUILD tensorflow/third_party/pybind11.BUILD +tensorflow/third_party/opt_einsum.BUILD tensorflow/third_party/linenoise.BUILD tensorflow/third_party/sqlite.BUILD tensorflow/third_party/common.bzl diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 9c36de6c8f8..529d6eeb4e7 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -3549,6 +3549,7 @@ py_library( ":math_ops", ":platform", "//tensorflow/compiler/tf2xla/ops:gen_xla_ops", + "@opt_einsum_archive//:opt_einsum", ], ) diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index a1dd732cd56..3b3a96c2ea4 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -183,6 +183,7 @@ filegroup( "@local_config_tensorrt//:LICENSE", "@nasm//:LICENSE", "@nsync//:LICENSE", + "@opt_einsum_archive//:LICENSE", "@pasta//:LICENSE", "@pcre//:LICENCE", "@png_archive//:LICENSE", diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py index 8e187e6029f..5868b763d77 100644 --- a/tensorflow/tools/pip_package/setup.py +++ b/tensorflow/tools/pip_package/setup.py @@ -57,6 +57,7 @@ REQUIRED_PACKAGES = [ 'keras_applications >= 1.0.8', 'keras_preprocessing >= 1.0.5', 'numpy >= 1.14.5, < 2.0', + 'opt_einsum >= 2.3.2', 'six >= 1.10.0', 'protobuf >= 3.6.1', 'tensorboard >= 1.14.0, < 1.15.0', diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 99f5447105b..8269e2d380f 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -327,6 +327,18 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""): ], ) + tf_http_archive( + name = "opt_einsum_archive", + build_file = clean_dep("//third_party:opt_einsum.BUILD"), + sha256 = "d3d464b4da7ef09e444c30e4003a27def37f85ff10ff2671e5f7d7813adac35b", + strip_prefix = "opt_einsum-2.3.2", + system_build_file = clean_dep("//third_party/systemlibs:opt_einsum.BUILD"), + urls = [ + "http://mirror.tensorflow.org/pypi.python.org/packages/f6/d6/44792ec668bcda7d91913c75237314e688f70415ab2acd7172c845f0b24f/opt_einsum-2.3.2.tar.gz", + "https://pypi.python.org/packages/f6/d6/44792ec668bcda7d91913c75237314e688f70415ab2acd7172c845f0b24f/opt_einsum-2.3.2.tar.gz", + ], + ) + tf_http_archive( name = "absl_py", sha256 = "3d0f39e0920379ff1393de04b573bca3484d82a5f8b939e9e83b20b6106c9bbe", diff --git a/third_party/opt_einsum.BUILD b/third_party/opt_einsum.BUILD new file mode 100644 index 00000000000..a54ce9a6164 --- /dev/null +++ b/third_party/opt_einsum.BUILD @@ -0,0 +1,29 @@ +# Description: +# opt_einsum is a library for optimizing tensor contraction order for einsum. + +licenses(["notice"]) # MIT + +exports_files(["LICENSE"]) + +py_library( + name = "opt_einsum", + srcs = [ + "opt_einsum/__init__.py", + "opt_einsum/_version.py", + "opt_einsum/backends/__init__.py", + "opt_einsum/backends/cupy.py", + "opt_einsum/backends/dispatch.py", + "opt_einsum/backends/tensorflow.py", + "opt_einsum/backends/theano.py", + "opt_einsum/backends/torch.py", + "opt_einsum/blas.py", + "opt_einsum/compat.py", + "opt_einsum/contract.py", + "opt_einsum/helpers.py", + "opt_einsum/parser.py", + "opt_einsum/paths.py", + "opt_einsum/sharing.py", + ], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], +) diff --git a/third_party/systemlibs/opt_einsum.BUILD b/third_party/systemlibs/opt_einsum.BUILD new file mode 100644 index 00000000000..b09820c5e7f --- /dev/null +++ b/third_party/systemlibs/opt_einsum.BUILD @@ -0,0 +1,11 @@ +licenses(["notice"]) # MIT + +filegroup( + name = "LICENSE", + visibility = ["//visibility:public"], +) + +py_library( + name = "opt_einsum", + visibility = ["//visibility:public"], +) diff --git a/third_party/systemlibs/syslibs_configure.bzl b/third_party/systemlibs/syslibs_configure.bzl index 114826b2af4..8c411a79f6a 100644 --- a/third_party/systemlibs/syslibs_configure.bzl +++ b/third_party/systemlibs/syslibs_configure.bzl @@ -32,6 +32,7 @@ VALID_LIBS = [ "lmdb", "nasm", "nsync", + "opt_einsum_archive", "org_sqlite", "pasta", "pcre",