Skip to content

Latest commit

 

History

History
153 lines (110 loc) · 3.75 KB

check.rst

File metadata and controls

153 lines (110 loc) · 3.75 KB

Assertion and Testing

Chainer provides some facilities to make debugging easy.

Type checking utilities

~chainer.FunctionNode uses a systematic type checking of the chainer.utils.type_check module. It enables users to easily find bugs of forward and backward implementations. You can find examples of type checking in some function implementations.

chainer.utils.type_check

chainer

chainer.utils.type_check.Expr chainer.utils.type_check.eval chainer.utils.type_check.expect chainer.utils.type_check.TypeInfo chainer.utils.type_check.TypeInfoTuple chainer.utils.type_check.Variable

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. The chainer.gradient_check module makes it easy to implement the gradient checking.

chainer.gradient_check

chainer

chainer.gradient_check.check_backward chainer.gradient_check.check_double_backward chainer.gradient_check.numerical_grad

Standard Assertions

The assertions have same names as NumPy's ones. The difference from NumPy is that they can accept both numpy.ndarray and cupy.ndarray.

chainer.testing

chainer

chainer.testing.assert_allclose chainer.testing.assert_warns

Function testing utilities

Utilities for testing functions.

chainer.testing.FunctionTestCase chainer.testing.unary_math_function_unittest

Utilities for testing links.

chainer.testing.LinkInitializersTestCase chainer.testing.LinkTestCase

Serialization testing utilities

Utilities for testing serializable objects.

chainer.testing.save_and_load chainer.testing.save_and_load_hdf5 chainer.testing.save_and_load_npz

Trainer Extension Testing Utilities

Utilities for testing trainer extensions <extensions>.

chainer.testing.get_trainer_with_mock_updater

Repeat decorators

These decorators have a decorated test run multiple times in a single invocation. Criteria of passing / failing of the test changes according to the type of decorators. See the documentation of each decorator for details.

chainer.testing.condition.repeat_with_success_at_least chainer.testing.condition.repeat chainer.testing.condition.retry

Unit test annotation

Decorators for annotating unit tests.

chainer.testing.attr.gpu chainer.testing.attr.multi_gpu chainer.testing.with_requires chainer.testing.fix_random

Parameterized test

Decorators for making a unit test parameterized.

chainer.testing.parameterize chainer.testing.product chainer.testing.product_dict chainer.testing.inject_backend_tests