AttributeError:'模块'对象没有属性'ceil'

时间:2019-04-08 12:20:07

标签: tensorflow pip install onnx

我已经从此link安装了模块onnx_tf。

此后,当我以python -c "import onnx_tf"验证安装时,遇到以下错误。我该如何解决?谢谢

testuser@testuser:~$ python -c "import onnx_tf"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/__init__.py", line 1, in <module>
    from . import frontend
  File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/frontend.py", line 18, in <module>
    from onnx_tf.common.handler_helper import get_all_frontend_handlers
  File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/common/handler_helper.py", line 5, in <module>
    from onnx_tf.handlers.backend import *  # noqa
  File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/handlers/backend/ceil.py", line 10, in <module>
    @tf_func(tf.ceil)
AttributeError: 'module' object has no attribute 'ceil'

2 个答案:

答案 0 :(得分:1)

检查您的张量流版本

pip show tensorflow

如果是2.x,则可能需要更改为旧版本。

pip install tensorflow-gpu==1.14

或者如果您使用的是CPU ...

pip install tensorflow==1.14

答案 1 :(得分:1)

以下内容为我解决了此问题:

  1. pip卸载onnx-tf
  2. pip安装git + https://github.com/onnx/onnx-tensorflow.git
  3. pip安装tensorflow-addons

(使用TensorFlow 2.3和Python 3.8)