导入错误:当我将 tensorflow_addons 作为 tfa 导入时,无法从“tensorflow.python.keras.engine”导入名称“keras_tensor”

时间:2021-04-10 05:23:16

标签: tensorflow keras deep-learning tensorflow2.0 keras-layer

<块引用> <块引用>

当我使用以下代码安装 tensorflow-addons 时

pip install tensorflow-addons
<块引用> <块引用>

然后显示

requirement already satisfied as tensorflow flow version 2.10.0
<块引用> <块引用>

当我运行此命令时,如下所示

import tensorflow_addons as tfa
<块引用> <块引用>

它显示下面显示的错误以解决此错误

C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_addons\utils\ensure_tf_install.py:67: UserWarning: Tensorflow Addons supports using Python ops for all Tensorflow versions above or equal to 2.3.0 and strictly below 2.5.0 (nightly versions are not supported). 
 The versions of TensorFlow you are currently using is 1.15.0 and is not supported. 
Some things might work, some things might not.
If you were to encounter a bug, do not file an issue.
If you want to make sure you're using a tested and supported configuration, either change the TensorFlow version or the TensorFlow Addons's version. 
You can find the compatibility matrix in TensorFlow Addon's readme:
https://github.com/tensorflow/addons
  UserWarning,
Traceback (most recent call last):

  File "<ipython-input-2-8e92e93ce06e>", line 1, in <module>
    import tensorflow_addons as tfa

  File "C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_addons\__init__.py", line 21, in <module>
    from tensorflow_addons import activations

  File "C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_addons\activations\__init__.py", line 17, in <module>
    from tensorflow_addons.activations.gelu import gelu

  File "C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_addons\activations\gelu.py", line 20, in <module>
    from tensorflow_addons.utils import types

  File "C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_addons\utils\types.py", line 23, in <module>
    from tensorflow.python.keras.engine import keras_tensor

ImportError: cannot import name 'keras_tensor' from 'tensorflow.python.keras.engine' (C:\Users\AKANKSHA BALI\Anaconda3\lib\site-packages\tensorflow_core\python\keras\engine\__init__.py)

0 个答案:

没有答案