make torch.histc ignore NaNs on CPU (#85870)
Summary: cuda torch.histc already ignores NaNs
Test Plan: unittest added
Differential Revision: D39911272
fix https://github.com/pytorch/pytorch/issues/85853
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85870
Approved by: https://github.com/ngimel