Warn user when resizing out Tensor after arange() (#29195)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/28347
gchanan , I am generating a warning as follows:
```
(torch_new) prasun@prasun-xps:~/dev/explore-array-computing$ python arange_test.py
Trying 45...
Before arange shape is torch.Size([1, 45])
After arange shape is torch.Size([1, 45])
Trying 46...
Before arange shape is torch.Size([1, 46])
After arange shape is torch.Size([1, 46])
Trying 47...
Before arange shape is torch.Size([1, 47])
After arange shape is torch.Size([1, 47])
Trying 48...
Before arange shape is torch.Size([1, 48])
After arange shape is torch.Size([1, 48])
Trying 49...
Before arange shape is torch.Size([1, 49])
../aten/src/ATen/native/RangeFactories.cpp:163: UserWarning: Size of out Tensor does not match the result Tensor. The output Tensor will be resized!
After arange shape is torch.Size([50])
Traceback (most recent call last):
File "arange_test.py", line 10, in <module>
assert len(line.shape) == 2
AssertionError
```
Is this alright ?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29195
Differential Revision: D18638184
Pulled By: ezyang
fbshipit-source-id: a93e4ce615b5a315570f9951021ef74fc1d895a6