Refactor CUDA bernoulli_kernel by using uniform_and_transform (#39652)
Summary:
- Fixes https://github.com/pytorch/pytorch/issues/39557 .
- Related https://github.com/pytorch/pytorch/issues/38558 .
- Simplifed `void bernoulli_kernel(TensorIterator& iter, double p_, RNG gen)` in `cuda/DistributionTemplates.h` by using `uniform_and_transform`.
- Unified `void bernoulli_kernel(TensorIterator& iter, double p_, RNG gen)` with other kernels in `cuda/DistributionTemplates.h`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39652
Differential Revision: D21974529
Pulled By: pbelevich
fbshipit-source-id: 5bbc06350714f4e72dc6ea8a0016769551610a52