python - 数据类型的张量流警告
问题描述
我在 Python 3.7.4 [64 位] 中安装了 tensorflow 和 numpy。当我尝试导入它时,我收到以下警告:
/home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516:FutureWarning:不推荐将(type,1)或'1type'作为类型的同义词; 在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint32 = np.dtype([("qint32", np.int32, 1)]) /home/user/. local/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525:FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。np_resource = np.dtype([("资源", np.ubyte, 1)])
/home/user/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541:FutureWarning:不推荐将(type,1)或'1type'作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: 传递 (type, 1) 或 '1type' 作为类型的同义词已被弃用;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/user/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning:不推荐将 (type, 1) 或 '1type' 作为类型的同义词传递;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。_np_qint32 = np.dtype([("
我有以下版本- numpy- 1.17.0 tensorflow- 1.14.0
如何解决 tensorflow 中不同数据类型的警告?
谢谢!
解决方案
它的意思是为了符合numpy
这条线的计划变化
np_resource = np.dtype([("resource", np.ubyte, 1)])
将需要重写为
np_resource = np.dtype([("resource", np.ubyte, (1,))])
我认为这不在您自己的代码中。
numpy 1.17 中的相关段落是:
https://docs.scipy.org/doc/numpy/release.html#future-changes
这是一个警告,而不是错误。numpy
在最近的类似 SO 中,发布者通过切换到早期版本来摆脱它。
“不推荐使用类型的同义词;在 numpy 的未来版本中,它将被理解为 (type, (1,)) / '(1,)type'。” TensorFlow 中的问题
推荐阅读
- r - 在 R Shiny 应用程序中编写宏或函数以简化 global.R 代码
- c++ - 加载 .avi 文件时,视频 QML 类型崩溃(0xC0000005:访问冲突)
- button - Bootstrap 4网格与列上的重叠按钮
- django - Django:不获取相同的对象
- excel - 从 Excel 工作表在登录脚本中定位用户
- python - Python Pandas 使用滚动时间窗口计数
- dart - Flutter中如何通过不同屏幕中的不同类发送数据
- python - MRJob 排序减速器输出
- r - R:networkD3 sankey plot - 颜色不显示
- python - 如何对两个数据帧的行应用 XNOR 操作