In debug mode, Chainer checks values of variables on runtime and shows more detailed error messages. It helps you to debug your programs. However, it requires some additional overhead time.
If you want to enable debug mode for the entire code, you can set
CHAINER_DEBUG environment variable to
You can also enable or disable debug mode for the specific scope of code with
chainer.using_config() or by changing
with chainer.using_config('debug', True): ...
See Configuring Chainer for the details of Chainer’s configuration mechanism.
In debug mode, Chainer checks all results of forward and backward computation, and if it finds a NaN value, it raises
Some functions and links also check validity of input values more strictly.
You can check if debug mode is enabled with
||Returns if the debug mode is enabled or not in the current thread.|
||Enables or disables the debug mode in the current thread.|
As of v2.0.0, it is recommended to turn on the debug mode using
See Configuring Chainer for the way to use the config object.
We leave the reference of the conventional way (which has been available since Chainer v1) as follows.
||Debug mode context.|