Fix poisson_nll_loss with full option (#28637)
Summary:
This fixes https://github.com/pytorch/pytorch/issues/28575.
It seems `poisson_nll_loss` was implemented with the incorrect assumption about `masked_select`, which actually doesn't return tensor with the same storage, so in-place operation used there didn't work as intended.
Here I used `masked_fill` instead.
Also, the existing test didn't have `reference_fn`, so I added it (although it's not fundamentally useful since current cpp `poisson_nll_loss` itself does exactly same algorithm as `reference_fn`).
Thanks in advance for reviewing this PR.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28637
Differential Revision: D18299724
Pulled By: albanD
fbshipit-source-id: 1aac5b20e77bf54874b79018207ba8f743766232