-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FunctionTestCase
for function tests
#3499
Conversation
f14de17
to
0ef66eb
Compare
f1a23c1
to
d70c772
Compare
d70c772
to
8924485
Compare
323b2d1
to
cf82cb5
Compare
cf82cb5
to
e575179
Compare
Jenkins CI test (for commit b0cc148, target branch master) succeeded! |
b0cc148
to
212441e
Compare
Rebased. Jenkins, test this please. |
Jenkins CI test (for commit 212441e, target branch master) succeeded! |
Jenkins, test this please. |
Jenkins CI test (for commit 8774fad, target branch master) succeeded! |
LGTM |
Jenkins CI test (for commit 8774fad, target branch master) failed with status FAILURE. |
This is an attempt to ease writing tests for functions.
Required methods
When you write a new function, you need to write 3 things in the corresponding test:
forward
: Forward implementation which simply calls the new function.forward_expected
: Forward reference implementation that returns the expected outputs.generate_inputs
: Generates input arrays to test.Test case class attributes (optional)
skip_forward_test
: If True, forward test will be skipped.skip_backward_test
: If True, backward test will be skipped.skip_double_backward_test
: If True, double-backward test will be skipped.dodge_nondifferentiable
: If True, backward/double-backward tests check for non-differentiable error and retry until differentiable inputs are finally sampled.contiguous
: Contiguousness of incoming arrays.None
: noncontiguous (default),'C'
: C-contiguous.Environment variables
(this feature has been removed from this PR)
To easily check numerical stability, the following environment variables can be used (set large number to repeatedly run the corresponding test)CHAINER_TEST_FORWARD_REPEAT
CHAINER_TEST_BACKWARD_REPEAT
CHAINER_TEST_DOUBLE_BACKWARD_REPEAT
PR dependency:
(merged)
Needs Fix indexing 0-dim array with boolean mask cupy/cupy#580 to run some example tests(merged)
Depends on Check for non-differentiable inputs #3551 (non-differentiable point detection)Switch device duringgradient_check
#5777Fixtesting.BackendConfig
context for repeated use #5779Resolve_as_noncontiguous_array
workaround for ChainerX #5781Fix scalar handling ofindices_and_sections
inchainerx.split
#5788