Hey @randino ,
Your code is wrong.
You are using mat to load your image and again assigning mat to a tensor with random value. So, no matter how many times you change the image path, you will get a random image. Let me explain.
This two lines will read the mat file.
mat = pjoin('./sample_data/', 'img.mat')
    #print('Mat loading ...')
mat = sio.loadmat(mat) # image values are loaded into 'mat' variable 

So, mat is now a numpy array image. But, this line will assign a tensor with random values, overwriting previous mat value.
mat = torch.randn(1, 1, 100, 100) # you are assigning a random tensor to 'mat' variable 

So, when you try to show or save the image, you get a random image.
plt.imshow(torchvision.utils.make_grid(mat).permute(1, 2, 0) # this mat is a random tensor

You can try the following.
mat = pjoin('./sample_data/', 'img.mat')
    #print('Mat loading ...')
mat = sio.loadmat(mat)
## extract image from mat
## .....
## .....
mat = torchvision.transforms.ToTensor()(mat)
#save image
torchvision.utils.save_image(mat, "image.png")
#show image 
plt.imshow(torchvision.transforms.ToPILImage()(mat))
plt.show()