fixing stride order for expanded tensor (#71665)
Summary:
The default initialization of stride order were not correct. This ended up with an expanded tensor showing wrong stride, since stride 0 is ignored by TensorIterator stride computation logic [Computing output strides].
Quick fix with cpp tests as well.
Note that things still look strange when we expand from a rank 1 size 1 tensor, as that gives us inconsistent strides.
```
In [7]: x = torch.rand([1])
In [8]: x.expand(1, 1, 4, 4).stride()
Out[8]: (0, 0, 0, 0)
In [9]: x.expand(4, 4, 1, 1).stride()
Out[9]: (0, 0, 1, 1)
In [10]: x.expand(4, 1, 4, 1).stride()
Out[10]: (0, 0, 0, 1)
```
Meanwhile, scalar tensor seems to work fine.
```
In [2]: x = torch.tensor(1.0)
In [3]: x.expand(4, 1, 1, 4).stride()
Out[3]: (0, 0, 0, 0)
In [4]: x.expand(4, 1, 4, 1).stride()
Out[4]: (0, 0, 0, 0)
In [5]: x.expand(4, 4, 1, 1).stride()
Out[5]: (0, 0, 0, 0)
In [6]: x.expand(1, 1, 4, 4).stride()
Out[6]: (0, 0, 0, 0)
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71665
Reviewed By: mrshenli
Differential Revision: D33849958
Pulled By: davidberard98
fbshipit-source-id: 982cd7fa352747d1e094a022475d6d1381ba75e5
(cherry picked from commit 0e0b587fe18ed47f4e801bb55a10641b9decd6e4)