【问题标题】:A lot of Warnings when importing tensorflow导入tensorflow时出现很多警告
【发布时间】:2019-08-27 07:36:02
【问题描述】:

我已经安装了 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 结束。这些警告有什么用?

【问题讨论】:

    标签: python python-3.x tensorflow anaconda


    【解决方案1】:

    我认为由于 Python=3.6 是支持 TensorFlow 的最新 python 版本,而用于 Python 3.6 的 NumPy 的最新版本是 NumPy 1.16.4;我不得不将我的 NumPy 包从 1.17 降级到 1.16.4 来解决这个问题。执行此操作后,警告消失了。

    【讨论】:

      【解决方案2】:

      Deprecated 表示该功能将在未来版本中删除。基本上,警告是针对 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,))
      

      而tensorflow在

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

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

      【讨论】:

      • 但是我的 TensorFlow 版本是 1.14.0 是最新的。
      猜你喜欢
      • 2011-12-03
      • 2013-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      相关资源
      最近更新 更多