WARNING:tensorflow: is deprecated and will be removed in a future version的解决方案

1 问题描述

一瞬间出现超多的WARNING

WARNING:tensorflow:From e:\matlab\CNN-classification\LSTM\train_test.py:56: MultiRNNCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.StackedRNNCells, and will be replaced by that in Tensorflow 2.0.
WARNING:tensorflow:From e:\matlab\CNN-classification\LSTM\train_test.py:61: dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `keras.layers.RNN(cell)`, which is equivalent to this API
WARNING:tensorflow:From D:\Program\Anaconda3\envs\cat\lib\site-packages\tensorflow\python\ops\init_ops.py:1251: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
WARNING:tensorflow:From D:\Program\Anaconda3\envs\cat\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py:738: calling Zeros.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor

WARNING:tensorflow: is deprecated and will be removed in a future version的解决方案_第1张图片

2 解决方案

这种警告其实只与版本升级有关,不必理会,但是如果连看都不想看到的话,那就将

import tensorflow as tf  

改为

import tensorflow as tf   
tf.get_logger().setLevel('ERROR')

即可。

3 感谢

https://stackoverflow.com/questions/60130622/warningtensorflow-with-constraint-is-deprecated-and-will-be-removed-in-a-future

你可能感兴趣的:(python,解决方案,anaconda,tensorflow,lstm,WARNING)