I got the below error when I am trying to add spectral normalization to my GAN model, how can I solve it?
AttributeError: 'MyConvo2d' object has no attribute 'weight'


My residual block code
class ResidualBlock(nn.Module):
    def __init__(self, input_dim, output_dim, kernel_size, resample=None, hw=DIM):
        super(ResidualBlock, self).__init__()

        self.input_dim = input_dim
        self.output_dim = output_dim
        self.kernel_size = kernel_size
        self.resample = resample
        self.bn1 = None
        self.bn2 = None
        self.relu1 = nn.ReLU()
        self.relu2 = nn.ReLU()
        
        if resample == 'down':
            self.bn1 = nn.LayerNorm([input_dim, hw, hw])
            self.bn2 = nn.LayerNorm([input_dim, hw, hw])
        elif resample == 'up':
            self.bn1 = nn.BatchNorm2d(input_dim)
            self.bn2 = nn.BatchNorm2d(output_dim)
        elif resample == None:
            # TODO: ????
            self.bn1 = nn.BatchNorm2d(output_dim)
            self.bn2 = nn.LayerNorm([input_dim, hw, hw])
        else:
            raise Exception('invalid resample value')

        if resample == 'down':
            self.conv_shortcut = MeanPoolConv(input_dim, output_dim, kernel_size=1, he_init=False)
            self.conv_1 = MyConvo2d(input_dim, input_dim, kernel_size=kernel_size, bias=False)
            self.conv_2 = ConvMeanPool(input_dim, output_dim, kernel_size=kernel_size)
            
        elif resample == 'up':
            self.conv_shortcut = UpSampleConv(input_dim, output_dim, kernel_size=1, he_init=False)
            self.conv_1 = UpSampleConv(input_dim, output_dim, kernel_size=kernel_size, bias=False)
            self.conv_2 = MyConvo2d(output_dim, output_dim, kernel_size=kernel_size)
            
        elif resample == None:
            self.conv_shortcut = MyConvo2d(input_dim, output_dim, kernel_size=1, he_init=False)
            self.conv_1 = MyConvo2d(input_dim, input_dim, kernel_size=kernel_size, bias=False)
            self.conv_2 = MyConvo2d(input_dim, output_dim, kernel_size=kernel_size)
        else:
            raise Exception('invalid resample value')

    def forward(self, input):
        if self.input_dim == self.output_dim and self.resample == None:
            shortcut = input
        else:
            shortcut = self.conv_shortcut(input)

        output = input
        output = self.bn1(output)
        output = self.relu1(output)
        output = self.conv_1(output)
        output = self.bn2(output)
        output = self.relu2(output)
        output = self.conv_2(output)

        return shortcut + output


After adding spectral normalization
class ResidualBlock(nn.Module):
    def __init__(self, input_dim, output_dim, kernel_size, resample=None, hw=DIM):
        super(ResidualBlock, self).__init__()

        self.input_dim = input_dim
        self.output_dim = output_dim
        self.kernel_size = kernel_size
        self.resample = resample
     #   self.bn1 = None
      #  self.bn2 = None
        
        
        layer1, layer2, layer3 = [], [], []
         
        if resample == 'down':            
            self.conv_shortcut = SpectralNorm(MeanPoolConv(input_dim, output_dim, kernel_size=1, he_init=False))
            
            layer2.append(nn.LayerNorm([input_dim, hw, hw]))
            layer2.append(nn.ReLU())
            layer2.append(SpectralNorm(MyConvo2d(input_dim, input_dim, kernel_size=kernel_size, bias=False)))
            self.l2 = nn.Sequential(*layer2)
            
            layer3.append(nn.LayerNorm([input_dim, hw, hw]))
            layer3.append(nn.ReLU())
            layer3.append(SpectralNorm(ConvMeanPool(input_dim, output_dim, kernel_size=kernel_size)))
            self.l3 = nn.Sequential(*layer3)


        elif resample == 'up':
            self.conv_shortcut = SpectralNorm(UpSampleConv(input_dim, output_dim, kernel_size=1, he_init=False))
            
            layer2.append(nn.BatchNorm2d(input_dim))
            layer2.append(nn.ReLU())           
            layer2.append(SpectralNorm(UpSampleConv(input_dim, output_dim, kernel_size=kernel_size, bias=False)))
            self.l2 = nn.Sequential(*layer2)
            
            
            layer3.append(nn.BatchNorm2d(output_dim))
            layer3.append(nn.ReLU())
            layer3.append(SpectralNorm(MyConvo2d(output_dim, output_dim, kernel_size=kernel_size)))
            self.l3 = nn.Sequential(*layer3)

            
        elif resample == None:
            self.conv_shortcut = SpectralNorm(MyConvo2d(input_dim, output_dim, kernel_size=1, he_init=False))
            
            layer2.append(nn.BatchNorm2d(output_dim))
            layer2.append(nn.ReLU())
            layer2.append(SpectralNorm(MyConvo2d(input_dim, input_dim, kernel_size=kernel_size, bias=False)))
            self.l2 = nn.Sequential(*layer2)

            layer3.append(n.LayerNorm([input_dim, hw, hw]))
            layer3.append(nn.ReLU())
            layer3.append(SpectralNorm(MyConvo2d(input_dim, output_dim, kernel_size=kernel_size)))
            self.l3 = nn.Sequential(*layer3)

        else:
            raise Exception('invalid resample value')



    def forward(self, input):
        if self.input_dim == self.output_dim and self.resample == None:
            shortcut = input
        else:
            shortcut = self.conv_shortcut(input)

        output = input
        output = self.l2(output)
        output = self.l3(output)

        return shortcut + output