如何关闭张量流贡献模块警告



我仍在使用tensorflow 1.15,并且不会将tensorflow 2.0用于当前项目。

我想知道如何关闭此警告消息:

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
* https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.

我已经阅读了修改后的页面,但仍然不知道如何关闭该消息。

经过仔细搜索,我在 https://github.com/tensorflow/tensorflow/issues/27045#issuecomment-480691244 中找到了答案

import tensorflow as tf
if type(tf.contrib) != type(tf): tf.contrib._warning = None

最新更新