Pytorch Model Summary
I am trying to load a pytorch model using:
model = torch.load('/content/gdrive/model.pth.tar', map_location='cpu')

I want to check the model summary. When I try:
print(model)

I get the following output:
{'state_dict': {'model.conv1.weight': tensor([[[[ 2.0076e-02,  1.5264e-02, -1.2309e-02,  ..., -4.0222e-02,
           -4.0527e-02, -6.4458e-02],
          [ 6.3291e-03,  3.8393e-03,  1.2400e-02,  ..., -3.3926e-03,
           -2.1063e-02, -3.4743e-02],
          [ 1.9969e-02,  2.0064e-02,  1.4004e-02,  ...,  8.7359e-02,
            5.4801e-02,  4.8791e-02],
          ...,
          [ 2.5362e-02,  1.1433e-02, -7.6776e-02,  ..., -3.4798e-01,
           -2.7198e-01, -1.2066e-01],
          [ 8.0373e-02,  1.3095e-01,  1.4240e-01,  ..., -2.2933e-03,
           -1.0469e-01, -1.0922e-01],
          [-1.1147e-03,  7.4572e-02,  1.2814e-01,  ...,  1.6903e-01,
            1.0619e-01,  2.4744e-02]], 
      'model.layer4.1.bn2.running_var': tensor([0.0271, 0.0155, 0.0199, 0.0198, 0.0132, 0.0148, 0.0182, 0.0170, 0.0134,
.
.
.


What does it even mean?
I also tried to use:
from torchsummary import summary
summary(model, input_size=(3, 224, 224))

But it gives me the following error:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
&lt;ipython-input-31-ca828d30bd38&gt; in &lt;module&gt;()
      1 from torchsummary import summary
----&gt; 2 summary(model, input_size=(3, 224, 224))

/usr/local/lib/python3.7/dist-packages/torchsummary/torchsummary.py in summary(model, input_size, batch_size, device)
     66 
     67     # register hook
---&gt; 68     model.apply(register_hook)
     69 
     70     # make a forward pass

AttributeError: 'dict' object has no attribute 'apply'

Please note that model is a custom model that I am trying to load.
How can I get a model summary in Pytorch?

You loaded the &quot;*.pt&quot; and didn't feed it to a model (which is just a dictionary of the weights depending on what you saved) this is why you get the following output:
{'state_dict': {'model.conv1.weight': tensor([[[[ 2.0076e-02,  1.5264e-02, -1.2309e-02,  ..., -4.0222e-02,
           -4.0527e-02, -6.4458e-02],
          [ 6.3291e-03,  3.8393e-03,  1.2400e-02,  ..., -3.3926e-03,
           -2.1063e-02, -3.4743e-02],
          [ 1.9969e-02,  2.0064e-02,  1.4004e-02,  ...,  8.7359e-02,
            5.4801e-02,  4.8791e-02],
          ...,
          [ 2.5362e-02,  1.1433e-02, -7.6776e-02,  ..., -3.4798e-01,
           -2.7198e-01, -1.2066e-01],
          [ 8.0373e-02,  1.3095e-01,  1.4240e-01,  ..., -2.2933e-03,
           -1.0469e-01, -1.0922e-01],
          [-1.1147e-03,  7.4572e-02,  1.2814e-01,  ...,  1.6903e-01,
            1.0619e-01,  2.4744e-02]], 
      'model.layer4.1.bn2.running_var': tensor([0.0271, 0.0155, 0.0199, 0.0198, 0.0132, 0.0148, 0.0182, 0.0170, 0.0134,
.
.
.

What you should do is:
model = TheModelClass(*args, **kwargs)
model.load_state_dict(torch.load(PATH))
print(model)

You can refer to the pytorch doc
Regarding your second attempt, the same issue causing the problem, summary expect a model and not a dictionary of the weights.
