chainer.force_backprop_mode¶
-
chainer.
force_backprop_mode
()[source]¶ Make a context manager which enables back-propagation.
When you want to enable back-propagation in
no_backprop_mode()
, call this method. :~chainer.Variable: created in this context always has a computational graph. If you call this method outside ofno_backprop_mode()
context, it changes nothing.In this example,
y
has a computational graph andy.backward
computes gradients of variables in the graph.>>> with chainer.no_backprop_mode(): ... with chainer.force_backprop_mode(): ... y = x + 1
See also
See
no_backprop_mode()
for details of back-prop mode.