torch.jit.save() generates different contents in a file among different endian machines
Labels: oncall: jit, module: POWER

### 🐛 Describe the bug

When I execute the following program on little (x86_64) and big (s390x) endian machines, I realized that the contents of `scriptmodule.pt` are different (e.g. at first two bytes in the below results, `4b50` v.s. `504b`). IMHO, the contents are stored as machine-native endian.  
Then, `torch.jit.load()` reads data by assuming the contents are stored as machine-native endian. As a result, the file `scriptmodule.pt` cannot be portable among different endian machines. For example, reading the file, which is stored on a little-endian machine, on a big-endian machime causes an exception. We expect that this file should be portable among machines.

I cannot find the specification of the serialization format (e.g. endianness in the serialization format) at [the API](https://pytorch.org/docs/stable/generated/torch.jit.save.html). ~~Is there any specification document for this serialization format?~~ I found [the document](https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/docs/serialization.md). However, I cannot see the description about endianness. Is there any further specification documents regarding endianness?

```python
import torch

class MyModule(torch.nn.Module):
    def forward(self, x):
        return x + 511

m = torch.jit.script(MyModule())
torch.jit.save(m, 'scriptmodule.pt')
```

The part of the result of `od -x scriptmodule.pt` on little endian machine (full result is [here](https://gist.github.com/kiszk/6c1bfe25b8c78fb4e2cf125ab997c3e4))
```
0000000 4b50 0403 0000 0808 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0015 000d 6373
0000040 6972 7470 6f6d 7564 656c 642f 7461 2e61
0000060 6b70 466c 0942 5a00 5a5a 5a5a 5a5a 5a5a
0000100 0280 5f63 745f 726f 6863 5f5f 4d0a 4d79
0000120 646f 6c75 0a65 0071 8129 287d 0858 0000
0000140 7400 6172 6e69 6e69 7167 8801 1658 0000
0000160 5f00 7369 665f 6c75 5f6c 6162 6b63 6177
0000200 6472 685f 6f6f 716b 4e02 6275 0371 502e
0000220 074b b608 67c1 4ff2 0000 4f00 0000 5000
0000240 034b 1404 0800 0808 0000 0000 0000 0000
0000260 0000 0000 0000 0000 1e00 2500 7300 7263
0000300 7069 6d74 646f 6c75 2f65 6f63 6564 5f2f
0000320 745f 726f 6863 5f5f 702e 4679 2142 5a00
0000340 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a
*
```

The part of the result of `od -x scriptmodule.pt` on big endian machine (full result is [here](https://gist.github.com/kiszk/6c1bfe25b8c78fb4e2cf125ab997c3e4))
```
0000000 504b 0304 0000 0808 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 1500 0d00 7363
0000040 7269 7074 6d6f 6475 6c65 2f64 6174 612e
0000060 706b 6c46 4209 005a 5a5a 5a5a 5a5a 5a5a
0000100 8002 635f 5f74 6f72 6368 5f5f 0a4d 794d
0000120 6f64 756c 650a 7100 2981 7d28 5800 0000
0000140 0874 7261 696e 696e 6771 0188 5800 0000
0000160 165f 6973 5f66 756c 6c5f 6261 636b 7761
0000200 7264 5f68 6f6f 6b71 024e 7562 7103 2e50
0000220 4b07 08f3 4c76 c34f 0000 004f 0000 0050
0000240 4b03 0414 0008 0808 0000 0000 0000 0000
0000260 0000 0000 0000 0000 001e 0025 0073 6372
0000300 6970 746d 6f64 756c 652f 636f 6465 2f5f
0000320 5f74 6f72 6368 5f5f 2e70 7946 4221 005a
0000340 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a 5a5a
*
```


### Versions

```
PyTorch version: 2.0.0a0+git215f4fc
Is debug build: True
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (s390x)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-5.4.0-125-generic-s390x-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] torch==2.0.0a0+git17c570c
[conda] Could not collect
```

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel