I am a beginner in Pytorch and I am stuck on a question for days. I want to save a image which is in Pytorch tensor form as .mat file. I looked but there doesn’t seem to be a direct method on converting Pytoch tensors to .mat file. One possible solution which I found was to convert it to numpy array, but since I am using Nvidia GPU, when I try converting Pytorch tensor to numpy array it gives me this error :
fake_images[0] = fake_images[0].numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first
Please can you help me with saving Pytorch tensor to .mat file while using GPU.
Thank you so so much in advance!!