Thanks @ptrblck that worked but still stucked in this error .

image887×376 14.4 KB

for my weight standardization class
CODE

making a separate class for weight standardization
class conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size , stride , padding):

    super().__init__(in_channels, out_channels, kernel_size)

def forward(self, x):

    weight = self.weight

    weight_mean = weight.mean(dim=1, keepdim=True).mean(dim=2,

                              keepdim=True).mean(dim=3, keepdim=True)

    weight = weight - weight_mean

    std = weight.view(weight.size(0), -1).std(dim=1).view(-1, 1, 1, 1) + 1e-5

    weight = weight / std.expand_as(weight)

    return F.conv2d(x, weight , self.stride , self.padding)

please help