Saving a pytoch tensor as a 32-bit grayscale Image
I have manipulated a 32-bit grayscale .tif image which I converted to tensor using PIL. After this I saved it with:
torchvision.utils.save_image(train_img_poac,fp=str(j)+&quot;.tif&quot;)

This method automatically converts the tensor to an RGB format image. I want my output image to be a 32-bit grayscale image.
I tried to use the arguments in the save_image function but could not find anything. Is converting it to numpy ndarray and then converting it to a 32-bit Image an option?

Unfortunately save_image doesn't have an option for preserving one-channel images. You can use a different library like OpenCV:
import cv2

image = train_img_poac.numpy()
cv2.imwrite('image_name', image)

