Skip to content

Commit 3da3ec7

Browse files
authored
migrate api and fix build issue (#2682)
* migrate api and fix build issue * fix some bugs
1 parent 14535fd commit 3da3ec7

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def create_build_configuration():
145145
write("build --copt=-mavx")
146146
write("build --cxxopt=-std=c++14")
147147
write("build --host_cxxopt=-std=c++14")
148+
write('build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"')
148149

149150
if os.getenv("TF_NEED_CUDA", "0") == "1":
150151
print("> Building GPU & CPU ops")

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
typeguard>=2.7
2+
packaging

tensorflow_addons/text/tests/crf_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""Tests for CRF."""
1616

1717
import itertools
18-
from distutils.version import LooseVersion
18+
from packaging.version import Version
1919

2020
import pytest
2121
import numpy as np
@@ -536,7 +536,7 @@ def call(self, y_true, y_pred):
536536

537537
tensor_name = (
538538
"tf.math.multiply"
539-
if LooseVersion(tf.__version__) >= "2.5.0"
539+
if Version(tf.__version__) >= Version("2.5.0")
540540
else "tf_op_layer_Mul"
541541
)
542542
y_data = {tensor_name: np.random.randint(0, 3, (5, 10))}

tensorflow_addons/utils/ensure_tf_install.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# needs to happen before anything else, since the imports below will try to
1919
# import TensorFlow, too.
2020

21-
from distutils.version import LooseVersion
21+
from packaging.version import Version
2222
import warnings
2323

2424
import tensorflow as tf
@@ -44,10 +44,10 @@ def _check_tf_version():
4444
)
4545
return
4646

47-
min_version = LooseVersion(INCLUSIVE_MIN_TF_VERSION)
48-
max_version = LooseVersion(EXCLUSIVE_MAX_TF_VERSION)
47+
min_version = Version(INCLUSIVE_MIN_TF_VERSION)
48+
max_version = Version(EXCLUSIVE_MAX_TF_VERSION)
4949

50-
if min_version <= LooseVersion(tf.__version__) < max_version:
50+
if min_version <= Version(tf.__version__) < max_version:
5151
return
5252

5353
warnings.warn(

tensorflow_addons/utils/resource_loader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# ==============================================================================
1515
"""Utilities similar to tf.python.platform.resource_loader."""
1616

17-
from distutils.version import LooseVersion
17+
from packaging.version import Version
1818
import os
1919
import warnings
2020

@@ -117,6 +117,6 @@ def abi_is_compatible():
117117
# tf-nightly
118118
return False
119119

120-
min_version = LooseVersion(INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY)
121-
max_version = LooseVersion(EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY)
122-
return min_version <= LooseVersion(tf.__version__) < max_version
120+
min_version = Version(INCLUSIVE_MIN_TF_VERSION_FOR_ABI_COMPATIBILITY)
121+
max_version = Version(EXCLUSIVE_MAX_TF_VERSION_FOR_ABI_COMPATIBILITY)
122+
return min_version <= Version(tf.__version__) < max_version

0 commit comments

Comments
 (0)