jupyter notebook 中的警告和错误到底有什么区别?

what exactly is the difference between warning and error in jupyter notebook?

我对 tensorflow 和一般编程是新手。 我正在按照 github (https://github.com/experiencor/keras-yolo3) 中的说明学习 YOLO-3 的对象检测。 在 运行 代码之后:

!python train.py -c config.json

我在输出中收到了几条消息,我正在尝试理解每条消息的含义。

其中之一如下:

WARNING:tensorflow:From train.py:26: The name tf.keras.backend.set_session is deprecated. Please use tf.compat.v1.keras.backend.set_session instead.

问题一:是吗,我是否必须修复代码的含义部分 (tf.keras.backend.set_session),因为它是此处所说的 "deprecated"?

问题二:警告一般如何,特别是如果不修复这个警告可能会影响我的最终模型?

答案一:长话短说,已弃用的功能是旧功能,被(希望)更好的功能取代,并且仍然存在以实现追溯兼容性。您可以使用它,但不会获得最新的 development/support,并且在某些时候,您的代码将不再起作用(因为不推荐使用的功能将在未来的版本中消失)。

回答二:

Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant raising an exception and terminating the program. For example, one might want to issue a warning when a program uses an obsolete module.

https://docs.python.org/3/library/warnings.html

总而言之,在这里,解释器只是温暖你,你正在使用一个你以后将无法使用的功能。