How to plot images with unnormalized?

I have written some code and it is working nicely, but it is normalized. What I want is unnormalized. I do not know how to achieve that.

def imshow(img, mean, std):
  mean = torch.tensor(mean).reshape(1,3,1,1)
  std = torch.tensor(std).reshape(1,3,1,1)
  return img * std + mean

def show_img(trainloader):
  classes = ["airplane","automobile","bird","cat","deer","dog","frog","horse","ship","truck"]
  dataiter = iter(trainloader)
  batch = next(dataiter)
  labels = batch[1][0:16]
  images = batch[0][0:16]

  for i in range(16):
    image = images[i].numpy()
    plt.imshow(np.rot90(image.T, k=3))

Your custom imshow method seems to remove the normalization already. Assuming you would like to plot the tensor as a uint8 image tensor, you could multiply it with 255 and transform to torch.unit8.