Clean up error handling in is_nonzero and where in TensorCompare.cpp (#38150)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/38150
Differential Revision: D21539736
Pulled By: ezyang
fbshipit-source-id: e390c12f5948192a552d66dcd1bb89b2cb45f170