for data in test_loader:
    # data=data.unsqueeze(0)
    output=model(data)
    print(output.shape[0],output.shape[1],output.shape[2],output.shape[3])
    print(output)
    output1=output.squeeze(0)
    tensor_to_img(output1)
def tensor_to_img(tensor):
    # image=tensor.cpu().clone()
    image=torch.squeeze(tensor)
   image=transforms.ToPILImage()(image)
   image.show()

I mean that I want to change the tensor’s dimensions to three-dimension