-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
177 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
diff --git a/tensorflow/api_template.__init__.py b/tensorflow/api_template.__init__.py | ||
index a0f88926..9c0bb098 100644 | ||
--- a/tensorflow/api_template.__init__.py | ||
+++ b/tensorflow/api_template.__init__.py | ||
@@ -27,7 +27,6 @@ this file with a file generated from [`api_template.__init__.py`](https://www.gi | ||
""" | ||
# pylint: disable=g-bad-import-order,protected-access,g-import-not-at-top | ||
|
||
-import distutils as _distutils | ||
import importlib | ||
import inspect as _inspect | ||
import os as _os | ||
@@ -95,10 +94,10 @@ _site_packages_dirs = [] | ||
if _site.ENABLE_USER_SITE and _site.USER_SITE is not None: | ||
_site_packages_dirs += [_site.USER_SITE] | ||
_site_packages_dirs += [p for p in _sys.path if "site-packages" in p] | ||
-if "getsitepackages" in dir(_site): | ||
+try: | ||
_site_packages_dirs += _site.getsitepackages() | ||
- | ||
-if "sysconfig" in dir(_distutils): | ||
+except AttributeError: | ||
+ import distutils as _distutils | ||
_site_packages_dirs += [_distutils.sysconfig.get_python_lib()] | ||
|
||
_site_packages_dirs = list(set(_site_packages_dirs)) | ||
diff --git a/tensorflow/api_template_v1.__init__.py b/tensorflow/api_template_v1.__init__.py | ||
index 6a4ab4e6..d6f8f2e0 100644 | ||
--- a/tensorflow/api_template_v1.__init__.py | ||
+++ b/tensorflow/api_template_v1.__init__.py | ||
@@ -14,7 +14,6 @@ | ||
# ============================================================================== | ||
"""Bring in all of the public TensorFlow interface into this module.""" | ||
|
||
-import distutils as _distutils | ||
import importlib | ||
import inspect as _inspect | ||
import os as _os | ||
@@ -144,10 +143,10 @@ from tensorflow.python.lib.io import file_io as _fi | ||
_site_packages_dirs = [] | ||
_site_packages_dirs += [] if _site.USER_SITE is None else [_site.USER_SITE] | ||
_site_packages_dirs += [p for p in _sys.path if "site-packages" in p] | ||
-if "getsitepackages" in dir(_site): | ||
+try: | ||
_site_packages_dirs += _site.getsitepackages() | ||
- | ||
-if "sysconfig" in dir(_distutils): | ||
+except AttributeError: | ||
+ import distutils as _distutils | ||
_site_packages_dirs += [_distutils.sysconfig.get_python_lib()] | ||
|
||
_site_packages_dirs = list(set(_site_packages_dirs)) | ||
diff --git a/tensorflow/lite/python/convert.py b/tensorflow/lite/python/convert.py | ||
index cfaff27a..a4eeb02f 100644 | ||
--- a/tensorflow/lite/python/convert.py | ||
+++ b/tensorflow/lite/python/convert.py | ||
@@ -14,7 +14,6 @@ | ||
# ============================================================================== | ||
"""Converts a frozen graph into a TFLite FlatBuffer.""" | ||
|
||
-import distutils.spawn | ||
import enum | ||
import hashlib | ||
import os as _os | ||
@@ -45,6 +44,10 @@ from tensorflow.python.platform import resource_loader as _resource_loader | ||
from tensorflow.python.util import deprecation | ||
from tensorflow.python.util.tf_export import tf_export as _tf_export | ||
|
||
+try: | ||
+ from shutil import which | ||
+except ImportError: | ||
+ from distutils.spawn import find_executable as which | ||
|
||
def _is_quantized_input_stats_required( | ||
conversion_flags: _conversion_flags_pb2.TocoFlags, | ||
@@ -399,7 +402,7 @@ def _run_deprecated_conversion_binary( | ||
RuntimeError: When conversion fails, an exception is raised with the error | ||
message embedded. | ||
""" | ||
- if distutils.spawn.find_executable(_deprecated_conversion_binary) is None: | ||
+ if which(_deprecated_conversion_binary) is None: | ||
raise ConverterError("""Could not find `toco_from_protos` binary, make sure | ||
your virtualenv bin directory or pip local bin directory is in your path. | ||
In particular, if you have installed TensorFlow with --user, make sure you |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
diff --git a/ci/official/requirements_updater/requirements.in b/ci/official/requirements_updater/requirements.in | ||
index 5c5892b2..0ee2eea0 100644 | ||
--- a/ci/official/requirements_updater/requirements.in | ||
+++ b/ci/official/requirements_updater/requirements.in | ||
@@ -1,6 +1,6 @@ | ||
# TODO(b/304751256): Adjust the numpy pin to a single version, when ready | ||
numpy ~= 1.23.5 ; python_version <= "3.11" | ||
-numpy ~= 1.26.0 ; python_version >= "3.12" | ||
+numpy ~= 2.0.0 ; python_version >= "3.12" | ||
wheel ~= 0.41.2 | ||
h5py >= 3.10.0 | ||
lit ~= 17.0.2 | ||
@@ -25,7 +25,8 @@ tensorboard ~= 2.17.0 | ||
# Test dependencies | ||
grpcio >= 1.24.3, < 2.0 | ||
portpicker == 1.6.0 | ||
-scipy == 1.11.3 | ||
+scipy == 1.11.3 ; python_version <= "3.11" | ||
+scipy == 1.14.0 ; python_version >= "3.12" | ||
requests == 2.31.0 | ||
packaging==23.2 | ||
setuptools==68.2.2 | ||
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py | ||
index 88da8b54..e4041765 100644 | ||
--- a/tensorflow/tools/pip_package/setup.py | ||
+++ b/tensorflow/tools/pip_package/setup.py | ||
@@ -86,7 +86,7 @@ REQUIRED_PACKAGES = [ | ||
'ml_dtypes >= 0.3.1, < 0.5.0', | ||
# TODO(b/304751256): Adjust the numpy pin to a single version, when ready | ||
'numpy >= 1.23.5, < 2.0.0 ; python_version <= "3.11"', | ||
- 'numpy >= 1.26.0, < 2.0.0 ; python_version >= "3.12"', | ||
+ 'numpy ~= 2.0.0 ; python_version >= "3.12"', | ||
'opt_einsum >= 2.3.2', | ||
'packaging', | ||
# pylint:disable=line-too-long |