I am getting the same error. My entire code is taken from https://github.com/hezhangsprinter/DCPDN/blob/master/dehaze22.py 21 and I am getting the error from line 193, I have defined it as:
My layer 1 has:
block = nn.Sequential()
block.add_module(name, nn.Conv2d(in_c,out_c, 4, 2, 1, bias=False))
block.add_module(name, nn.BatchNorm2d(out_c))
When I printed the size of out1 I am getting 1,64,128,128.
I am not sure why I am getting the error from BatchNorm2d