Tensor to numpy

hi,

I have a problem when going from tensor to numpy for instance when i use this :
‘’‘transforms.ToTensor()’’’
then i conver my tensors to arrays to plot them i get an image where i have the same image repeatedcap.PNG

however when i use “” ((torch.from_numpy(image_1))""" I get the correct answer.

My problem now is that my Neural network output a tensor and when i convert it to numpy to plot it i get the error above

anyone have an idea how I can solve this ???

to transform tensor to numpy i use .cpu().numpy()

Most likely you are reshaping/permuting in a wrong way.
Usually these kind of interleaved outputs are created, if you wanted to swap some dimensions and have used view/reshape instead of permute.
Could this be the case?

thank you @ptrblck I tried permute and it worked better thanks A lot