Could you print stacktrace of error?
And what is the reason behind this line? In first post, you mentioned that imgs are float between [0, 1], etc.



 John_J_Watson:

img = Image.fromarray(imgs[i].permute(1, 2, 0).numpy())


So proper change would be



 Nikronic:

img = Image.fromarray((255*imgs[i].permute(1, 2, 0)).numpy().astype(np.uint8))


If you are using PyTorch transforms, still best approach is to use transforms.ToTensor and transforms.ToPILImage in Compose of transformation.