Add tensor.view(dtype) (#47951)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/42571
Note that this functionality is a subset of [`numpy.ndarray.view`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.view.html):
- this only supports viewing a tensor as a dtype with the same number of bytes
- this does not support viewing a tensor as a subclass of `torch.Tensor`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47951
Reviewed By: ngimel
Differential Revision: D25062301
Pulled By: mruberry
fbshipit-source-id: 9fefaaef77f15d5b863ccd12d836932983794475