Fix distributions which don't properly honor validate_args=False (#53600)
Summary:
A number of derived distributions use base distributions in their
implementation.
We add what we hope is a comprehensive test whether all distributions
actually honor skipping validation of arguments in log_prob and then
fix the bugs we found. These bugs are particularly cumbersome in
PyTorch 1.8 and master when validate_args is turned on by default
In addition one might argue that validate_args is not performing
as well as it should when the default is not to validate but the
validation is turned on in instantiation.
Arguably, there is another set of bugs or at least inconsistencies
when validation of inputs does not prevent invalid indices in
sample validation (when with validation an IndexError is raised
in the test). We would encourage the implementors to be more
ambitious when validation is turned on and amend sample validation
to throw a ValueError for consistency.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53600
Reviewed By: mrshenli
Differential Revision: D26928088
Pulled By: neerajprad
fbshipit-source-id: 52784a754da2faee1a922976e2142957c6c02e28