【问题标题】:Tensorflow of Jupyter Notebook gives "FutureWarning"Jupyter Notebook 的 TensorFlow 给出“FutureWarning”
【发布时间】:2020-02-01 02:13:26
【问题描述】:

当我在 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)])

【问题讨论】:

    标签: tensorflow jupyter-notebook anaconda


    【解决方案1】:

    问题是什么? FutureWarning 不是错误。它警告用户将来会弃用某个功能。

    您看到的警告已在 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
    

    【讨论】:

    • 没用。 Jupyter Notebook 显示“未找到模块错误”。
    猜你喜欢
    • 2019-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    • 2019-01-07
    • 1970-01-01
    • 2023-02-16
    相关资源
    最近更新 更多