I have created a custom layer in which i have initialized a glorot uniform weight given input_shape = (1,3,299,299).
class CustomLayer(torch.nn.Module):
    def __init__(self, input_shape):
        super(CustomLayer,self).__init__()
        zeros = torch.zeros(input_shape)
        self.weights = torch.nn.Parameter(zeros)
        torch.nn.init.xavier_uniform_(self.weights)
    def forward(self, x):
        out= torch.tanh(self.weights)
        return out+x
        
class MimicAndFool(torch.nn.Module):
    def __init__(self,input_shape):
        super(MimicAndFool,self).__init__()
        self.custom = CustomLayer(input_shape)
    def forward(self,x):
        out = self.custom(x)
        #statement 2
        #statement 3...
        #statement n
        return out

After I print the summary
input_shape = (1,3,299,299)
maf = MimicAndFool(input_shape)
summary(maf,(3,299,299))

It says that the number of parameters for this custom layer is zero!
image807×127 3.59 KB
Please tell me what I’m missing out on . The number of parameters should have been = 3 * 299 * 299 = 268203