Swap file size on BE platform (#92810)
Fixes #92808
This PR fixes SIGSEGV on a big-endian machine when reading pickle data.
The root cause is not to convert `size`, which is read from a file, from little-endian to big-endian while `size` is used in a method. The fix is to convert `size` on a big-endian machine instead of `nbytes`.
I confirmed that the program in the issue works w/o SIGSEGV and the test passes, with this fix in master branch.
```
$ python test/test_autograd.py TestAutograd.test_pickle
.
----------------------------------------------------------------------
Ran 1 test in 0.010s
OK
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92810
Approved by: https://github.com/malfet