首页 > 解决方案 > 导入张量流时的未来警告

问题描述

我刚开始学习 tensorflow,碰巧通过了 IPython 控制台生成的未来警告。

这是代码块:

import tensorflow as tf
x1 = tf.constant(4)
print(x1)

我用名称“hello.py”保存它并在 IPython 控制台上逐行执行它。

该命令成功执行,但以警告告终。

Python 3.6.7 |Anaconda, Inc.| (default, Oct 28 2018, 19:44:12) [MSC v.1915 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.2.0 -- An enhanced Interactive Python.

In [1]: import tensorflow as tf
C:\Users\singh\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

In [2]: x1 = tf.constant(4)

In [3]: print(x1)
Tensor("Const:0", shape=(), dtype=int32)

我不明白为什么我会收到此警告。有没有什么办法解决这一问题?

TensorFlow 版本:1.10.2
Python IDE:Spyder (Anaconda)
操作系统:Windows 10 x64

标签: python-3.xtensorflow

解决方案


使用这个命令行 pip install h5py==2.8.0rc1 包 h5py 可能有问题,只需升级它就可以解决你的问题


推荐阅读