哪些numpy版本与Tensorflow 1.14.0兼容

时间:2019-11-01 16:08:58

标签: tensorflow

我收到将1.14.0与numpy 1.17.2结合使用的警告。这些在一起吗?我找不到任何说明兼容性要求的官方TF页面。

2 个答案:

答案 0 :(得分:3)

请将numpy版本从1.17.2降级为1.16.4将解决Tensorflow 1.14.0的问题

这里可以复制问题

import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)

输出:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

1.14.0
1.17.2

要解决此问题,请执行以下代码,将numpy降级为1.16.4

pip uninstall numpy
pip install numpy==1.16.4

之后,请重新启动运行系统并执行以下代码

import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)

输出:

1.14.0
1.16.4

答案 1 :(得分:0)

那些正在寻找 tensorflow2 和 numpy 兼容版本的人。他们一起工作得很好。

Tensorflow 2.4.1
numpy 1.19.5