导入张量流时有很多警告

时间:2019-08-27 07:36:02

标签: python python-3.x tensorflow anaconda

我已经安装了TensorFlow(通过在Conda上创建一个环境,然后使用本教程视频(https://www.youtube.com/watch?v=ujTCoH21GlA&list=PLzMcBGfZo4-mP7qA9cagf68V06sko5otr&index=1)在其上安装张量流

但是当我运行简单的代码时:

     import tensorflow

它会返回很多这样的警告:

    C:\Users\safa\Anaconda3\envs\tensor\lib\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)])

但是,该过程以退出代码0结尾。这些警告是针对什么的?

2 个答案:

答案 0 :(得分:0)

已弃用意味着该功能将在将来的版本中删除。基本上,警告是针对numpy中的tensorflow本身,因为tensorflow使用了numpy中不推荐使用的函数。

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,))

张量流在

中使用(type,1)
'(1,)type'.np_resource = np.dtype([("resource", np.ubyte, 1)])

这实际上对您来说不是问题,但是如果您担心它,可以尝试将tensorflow更新为最新版本。

答案 1 :(得分:0)

我认为,因为Python = 3.6是支持TensorFlow的最新python版本,而适用于Python 3.6的NumPy的最新版本是NumPy 1.16.4;我必须将我的NumPy软件包从1.17降级到1.16.4才能解决此问题。完成此操作后,警告消失了。