torch.from_numpy fix for np.int (#25139)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/22615
Because of different sizeof(long) we have the following relations between NPY_TYPES and NPY_INTXX aliases:
```
int value Enum Unix Windows
1 NPY_BYTE NPY_INT8 NPY_INT8
3 NPY_SHORT NPY_INT16 NPY_INT16
5 NPY_INT NPY_INT32 -
7 NPY_LONG NPY_INT64 NPY_INT32
9 NPY_LONGLONG - NPY_INT64
```
I suggest the following fix for `numpy_dtype_to_aten` method:
```
if (dtype == NPY_INT || dtype == NPY_INT32) {
return kInt;
} else if (dtype == NPY_LONGLONG || dtype == NPY_INT64) {
return kLong;
}
```
On Unix it will be replaced with:
Unix:
```
if (dtype == 5 || dtype == 5) {
return kInt;
} else if (dtype == 9 || dtype == 7) {
return kLong;
}
```
and on Windows with:
```
if (dtype == 5 || dtype == 7) {
return kInt;
} else if (dtype == 9 || dtype == 9) {
return kLong;
}
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25139
Differential Revision: D17048443
Pulled By: pbelevich
fbshipit-source-id: 9f2c27ff2829b893a35d3d57f176a58e7749a468