Model produce nothing

Hi. I have created a multi-module model by using add_module method.
First I defined an empty class model:

class EmptyModel(nn.Module):
    def __init__(self):
        super(EmptyModel, self).__init__()

    def forward(self, x):
        return x

empty_model = EmptyModel()

Then I add modules from another previously defined model:


As you can see, the first module is already trained so I set it to eval().
When I use torchsummary to visualize each of these modules, everything works fine. They work properly, But when I try to visualize the whole model, I get an error:

  File "/home/aasadian/.local/lib/python3.6/site-packages/torchsummary/", line 102, in summary
    total_params_size = abs(total_params.numpy() * 4. / (1024 ** 2.))
AttributeError: 'int' object has no attribute 'numpy'

Also, I found that when I pass some data points, the whole model does not produce output, i.e., if I feed my model with a batch of data (32,3,224,224), the output is the same size. any help is appreciated.

This is expected, since the forward method was never changed.
Even though you were adding valid modules via add_module to empty_model, they will never be used in:

    def forward(self, x):
        return x

Thank you. It makes sense.