Pytorch Model not initializing

I created a model like resnet but for tabular data here is model architecture

class Model(nn.Module):      # <-- Update
    def __init__(self, num_features, num_targets, hidden_size):
        super(Model, self).__init__()
        head1 = nn.Sequential(
        nn.utils.weight_norm(nn.Linear(num_features, hidden_size)),
        head2 = nn.Sequential(
        nn.utils.weight_norm(nn.Linear(hidden_size, hidden_size)),
        head3 = nn.Sequential(
        nn.utils.weight_norm(nn.Linear(hidden_size, num_targets))
    def forward(self, x):
        head1_out = head1(x)
        concat_1 =, head1_out), dim=1)
        head2_out = head2(concat)
        concat_2 =, head2_out), dim=1)
        out = head3(concat_2)
        return out

When I initialize it it doesn’t give me any error but doesn’t show any output either.
Any help or suggestions would be appreciated.

Could you explain what kind of output you are expecting and how you are initializing the model?
If you are using:

model = Model(num_features, num_targets, hidden_size)

then model should be the object of your custom Model class.

Yes, this is how I am initializing it. And I am working with a multilabel classification problem

@ptrblck Any solution?

I don’t know exactly what the issue is.
Could you explain, if you are seeing any errors or what you would expect, which is not working at the moment?

I figured it out. I had to write self.head1.

Oh sorry, I completely missed this issue and couldn’t figure out what the problem is. :confused:
I’m glad you’ve figured it out.