我收到了将 1.14.0 与 numpy 1.17.2 结合使用的警告。这些一起去吗?我找不到任何说明兼容性要求的官方 TF 页面。
请将numpy版本从1.17.2to降级1.16.4将解决问题Tensorflow 1.14.0
这里可以复制问题
import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)
Run Code Online (Sandbox Code Playgroud)
输出:
/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
Run Code Online (Sandbox Code Playgroud)
要解决此问题,请执行以下代码降级numpy到1.16.4
pip uninstall numpy
pip install numpy==1.16.4
Run Code Online (Sandbox Code Playgroud)
之后,请重新启动您的运行时并执行以下代码
import tensorflow as tf
print(tf.__version__)
import numpy as np
print(np.__version__)
Run Code Online (Sandbox Code Playgroud)
输出:
1.14.0
1.16.4
Run Code Online (Sandbox Code Playgroud)