This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two issues.
Issue 1: #14288
Issue 2:
[2020-11-17T06:58:34.678Z] def check_passthrough(ratio, shape, cudnn_off=True):
[2020-11-17T06:58:34.678Z] # test inference_mode forward and then backward
[2020-11-17T06:58:34.678Z] a = mx.random.uniform(shape=shape)
[2020-11-17T06:58:34.678Z] a.attach_grad()
[2020-11-17T06:58:34.678Z] with mx.autograd.record(train_mode=False):
[2020-11-17T06:58:34.678Z] b = mx.nd.Dropout(a, ratio, cudnn_off=cudnn_off) # dropout acts as identity
[2020-11-17T06:58:34.678Z] b.backward()
[2020-11-17T06:58:34.678Z] assert_almost_equal(a.grad.asnumpy(), mx.nd.ones_like(b).asnumpy())
[2020-11-17T06:58:34.678Z]
[2020-11-17T06:58:34.678Z] shape = (100, 100)
[2020-11-17T06:58:34.678Z] check_dropout_ratio(0.5, shape)
[2020-11-17T06:58:34.678Z] check_dropout_ratio(0.0, shape)
[2020-11-17T06:58:34.678Z] > check_dropout_ratio(1.0, shape)
[...]
[2020-11-17T06:58:34.678Z] # Hopefully should be within ratio/2 %
[2020-11-17T06:58:34.678Z] error = abs(output_sum - input_sum) / input_sum
[2020-11-17T06:58:34.678Z] if ratio == 1.0:
[2020-11-17T06:58:34.678Z] > assert output_zeroes == len(input)
[2020-11-17T06:58:34.678Z] E assert 9999 == 10000
[2020-11-17T06:58:34.678Z] E +9999
[2020-11-17T06:58:34.678Z] E -10000