Assertion and Testing¶
Chainer provides some facilities to make debugging easy.
Type checking utilities¶
Function uses a systematic type checking of the
It enables users to easily find bugs of forward and backward implementations.
You can find examples of type checking in some function implementations.
||Abstract syntax tree of an expression.|
||Evaluates and tests all given expressions.|
||Type information of an input/gradient array.|
||Type information of input/gradient tuples.|
Gradient checking utilities¶
Most function implementations are numerically tested by gradient checking.
This method computes numerical gradients of forward routines and compares their results with the corresponding backward routines.
It enables us to make the source of issues clear when we hit an error of gradient computations.
chainer.gradient_check module makes it easy to implement the gradient checking.
||Test backward procedure of a given function.|
||Computes numerical gradient by finite differences.|
The assertions have same names as NumPy’s ones.
The difference from NumPy is that they can accept both
||Asserts if some corresponding element of x and y differs too much.|