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
Sample stable inputs in tests of group normalization #7894
Conversation
if x_groups.std(axis=2).min() >= min_std: | ||
break | ||
retry += 1 | ||
assert retry <= 10, 'Too many retries to generate inputs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this fine, I am just curious about how many retries does it take on average to sample a good input :).
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, shape=(3, 20), groups=4
samples 5 per group. For each group std ≥ 0.2 with probability ~97.8%.
>>> (np.random.uniform(-1, 1, (1000000, 5)).std(axis=1) > 0.2).sum()
978456
A try satisfies the condition for all groups with probability at least 0.97 ** (3 * 4)
. Thus it fails 10 tries with probability
>>> (1 - 0.97 ** (3 * 4)) ** 10
7.235207665894931e-06
... I see. It's not sufficiently small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the great explanation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Jenkins, test this please |
Jenkins CI test (for commit c66a532, target branch master) failed with status FAILURE. |
CI unrelated |
Sample stable inputs in tests of group normalization
Fix #6911.