Instance Norm: ValueError: Expected more than 1 spatial element when training, got input size torch.Size([128, 512, 1, 1])

As written in the title, InstanceNorm2d requires a size of tensor (N, C, H, W) or (C, H, W) where H and W must be greater than 1.

I cannot figure out where the error occurred but one clear thing is somewhere InstanceNorm2d takes (128, 512, 1, 1) as an input.
You should find where it is.

2 Likes