keras
keras copied to clipboard
Unexpected depreciation warning in tensorflow 2.16.1
Python 3.12 tensorflow 2.16.1 keras 3.3.3 Windows 11
I have just updated to tensorflow 2.16.1 and am going through my code checking of compatablity. When I import my tensorflow code I get the warning:
**WARNING:tensorflow:From \venv\Lib\site-packages\keras\src\backend\common\global_state.py:82: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.
The warning points to line 82 in global_state.py in the keras backend, which uses the correct statement (tf.compat.v1.reset_default_graph). I have pin pointed this warning coming from my use of keras.backend.clear_session().
Is this warning valid? Because from what I can see the depreciated tf.reset_default_graph is not used
EDIT: I have got my tensorflow code running and so far it seems to be work without giving any errors....it has called the keras.backend.clear_session() several times and no errors.
I'm not able to notice the warning in the latest TensorFlow version when the keras.backend.clear_session() is used, Keras uses tf.compat.v1.reset_default_graph in the code as mentioned below
https://github.com/keras-team/keras/blob/f6c4ac55692c132cd16211f4877fac6dbeead749/keras/src/backend/common/global_state.py#L82
As I couldn't find a reason for the warning either, that's why I raised the issue, it's probably my installation, in the next couple of weeks I'll be transfering the code to a Linux machine, I'll see what happens and report back. In the mean time how do I supress this warning? It's filling my console with red text!
You can follow this https://www.tensorflow.org/api_docs/python/tf/keras/config/disable_interactive_logging and this here https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
It must be something to do with my installation on my Windows machine, because I don't get the error on my Linux machine. Thanks for your help.
@whichedge , Could you please close the issue of you don't have anymore questions. Thanks
Thanks for your help... closing