Here is a piece of code (running on Linux CentOS 7.7.1908, x86_64)
import torch #v1.3.0
import numpy as np #v1.14.3
import matplotlib.pyplot as plt
from astropy.io.fits import getdata #v3.0.2
data, hdr = getdata("afile.fits", 0, header=True) #gives dtype=float32 2d array
plt.imshow(data)
plt.show()
This gives a nice 512x512 image
Now, I would like to convert "data" into a PyTorch tensor:
a = torch.from_numpy(data)
Although, PyTorch raises:
ValueError: given numpy array has byte order different from the native byte order. Conversion between byte orders is currently not supported.
Well, I have tried different manipulations with no success: ie. byteswap(), copy()
An idea?
PS: the same error occurs when I transfer my data to Mac OSX (Mojave) while still matplotlib is ok.