tensorflow - Jupyter Notebook 的 TensorFlow 给出“FutureWarning”
问题描述
当我在Jupyter Notebook中运行Tensorflow程序时,我得到了输出以及以下“ FUTUREWARNING ”。我使用以下方法在 Anaconda 中创建了一个 Tensorflow 环境:conda create -n tf tensorflow
我还使用命令初始化了 Tensorflow 环境:conda activate
程序 :
import tensorflow as tf
print ("TensorFlow version: " + tf.__version__)
输出 :
/home/atishrathour/.local/lib/python3.7/site-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)])
/home/atishrathour/.local/lib/python3.7/site-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)])
/home/atishrathour/.local/lib/python3.7/site-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)])
/home/atishrathour/.local/lib/python3.7/site-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)])
/home/atishrathour/.local/lib/python3.7/site-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)])
/home/atishrathour/.local/lib/python3.7/site-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)])
TensorFlow 版本:1.14.0
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:541: 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)])
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:542: 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)])
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:543: 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)])
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:544: 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)])
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:545: 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)])
/home/atishrathour/.local/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub
/dtypes.py:550: 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)])
解决方案
问题是什么?AFutureWarning
不是错误。它警告用户将来会弃用某个功能。
您看到的警告已在 GitHub 上的tensorflow/tensorflow#30427中报告。它们可能是良性的,但如果您想摆脱它们,一个潜在的解决方案是创建或新的 conda 环境并使用 conda 或 pip 重新安装 tensorflow。
所以要么:
conda create --name tf-env tensorflow
或者
conda create --name tf-env python=3.6
conda activate tf-env
pip install --no-cache-dir tensorflow
推荐阅读
- c# - 在脚本之间传递 int
- sonarqube - 在 SonarQube 中显示 0% 的覆盖率(与 Teamcity 的 .Net 项目集成)
- c# - 如何异步调用任何 c# 代码(函数、Web 引用、API 调用)?
- node.js - 如何使用猫鼬方案验证密码的长度?
- angular - 未捕获的错误:无法解析 EventsComponent (Angular) 的所有参数
- java - Spring Data JPA @Query Annotation 出现问题(SQL 语法错误)
- jvm - 如何使用 Micrometer 和 Alertmanager 在 Prometheus 中提醒 JVM 内存使用情况
- javascript - 在 IE 和 Edge 上不记得 Cookie
- excel - 调整大小和移动图表源范围 VBA
- deck.gl - React 中带有控制器按钮的基本 DeckGL 地图