How to rotate images from npy files?

Hi, all.
I’m tried to load images from npy files with pytorch dataloader. but I failed. So I googling some codes like this.

x_train = np.load('datasets/train.npy', mmap_mode='r')
batches = int(float(x_train.shape[0]) / batch_size)
for b in range(batches):
     X = torch.from_numpy(x_train[b * batch_size:(1 + b) * batch_size])
from torchvision.utils import save_image
save_image(X, 'image.png')

Now I can load images, but they are rotated 90 degrees.
How can I rotate this images ?
Can I rotate this from save_image function?

You cannot rotate an image inside of save_image() [1], but you can use the method

torchvision.transforms.functional.roate(img, angle, resample=False, expand=False, center=None)

to apply transformations to PIL images, while using PyTorch [2].