Skip to content

Commit

Permalink
Fixes test_operator_gpu.test_multinomial_generator (apache#14475)
Browse files Browse the repository at this point in the history
* adjust the success rate

* add comments
  • Loading branch information
stu1130 authored and vdantu committed Mar 31, 2019
1 parent 88aaa50 commit a803f0f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/python/unittest/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,20 @@ def quantize_probs(probs, dtype):
quantized_probs = quantize_probs(probs, dtype)
generator_mx = lambda x: mx.nd.random.multinomial(data=mx.nd.array(quantized_probs, ctx=ctx, dtype=dtype),
shape=x).asnumpy()
# success_rate was set to 0.15 since PR #13498 and became flaky
# both of previous issues(#14457, #14158) failed with success_rate 0.25
# In func verify_generator inside test_utilis.py
# it raise the error when success_num(1) < nrepeat(5) * success_rate(0.25)
# by changing the 0.25 -> 0.2 solve these edge case but still have strictness
verify_generator(generator=generator_mx, buckets=buckets, probs=quantized_probs,
nsamples=samples, nrepeat=trials)
nsamples=samples, nrepeat=trials, success_rate=0.20)
generator_mx_same_seed = \
lambda x: np.concatenate(
[mx.nd.random.multinomial(data=mx.nd.array(quantized_probs, ctx=ctx, dtype=dtype),
shape=x // 10).asnumpy()
for _ in range(10)])
verify_generator(generator=generator_mx_same_seed, buckets=buckets, probs=quantized_probs,
nsamples=samples, nrepeat=trials)
nsamples=samples, nrepeat=trials, success_rate=0.20)


@with_seed()
Expand Down

0 comments on commit a803f0f

Please sign in to comment.