TorchInfo should say the size of the model, right?

maycaj: <h1><a name="i-am-not-sure-why-torchinfo-is-not-reporting-the-size-of-the-model-my-code-looks-like-this-import-torchinfo-from-torchinfo-import-summary-summarymodel_0-input_sizeprintimg_customshape-do-a-test-pass-through-of-an-example-input-size-the-model-output-looks-like-this-1" class="anchor" href="#i-am-not-sure-why-torchinfo-is-not-reporting-the-size-of-the-model-my-code-looks-like-this-import-torchinfo-from-torchinfo-import-summary-summarymodel_0-input_sizeprintimg_customshape-do-a-test-pass-through-of-an-example-input-size-the-model-output-looks-like-this-1"></a>I am not sure why TorchInfo is not reporting the size of the model.<br>
My code looks like this<br>
<code>import torchinfo from torchinfo import summary summary(model_0, input_size=print(img_custom.shape)) # do a test pass through of an example input size</code><br>
The model output looks like this:</h1>
<h1><a name="layer-typedepth-idx-param-2" class="anchor" href="#layer-typedepth-idx-param-2"></a>Layer (type:depth-idx)                   Param #</h1>
<h1><a name="tinyvgg-sequential-1-1-conv2d-2-1-11530-relu-2-2-conv2d-2-3-910-relu-2-4-maxpool2d-2-5-sequential-1-2-conv2d-2-6-910-relu-2-7-conv2d-2-8-910-relu-2-9-maxpool2d-2-10-sequential-1-3-flatten-2-11-linear-2-12-94083-3" class="anchor" href="#tinyvgg-sequential-1-1-conv2d-2-1-11530-relu-2-2-conv2d-2-3-910-relu-2-4-maxpool2d-2-5-sequential-1-2-conv2d-2-6-910-relu-2-7-conv2d-2-8-910-relu-2-9-maxpool2d-2-10-sequential-1-3-flatten-2-11-linear-2-12-94083-3"></a>TinyVGG                                  –<br>
├─Sequential: 1-1                        –<br>
│    └─Conv2d: 2-1                       11,530<br>
│    └─ReLU: 2-2                         –<br>
│    └─Conv2d: 2-3                       910<br>
│    └─ReLU: 2-4                         –<br>
│    └─MaxPool2d: 2-5                    –<br>
├─Sequential: 1-2                        –<br>
│    └─Conv2d: 2-6                       910<br>
│    └─ReLU: 2-7                         –<br>
│    └─Conv2d: 2-8                       910<br>
│    └─ReLU: 2-9                         –<br>
│    └─MaxPool2d: 2-10                   –<br>
├─Sequential: 1-3                        –<br>
│    └─Flatten: 2-11                     –<br>
│    └─Linear: 2-12                      94,083</h1>
<h1><a name="total-params-108343-trainable-params-108343-non-trainable-params-0-4" class="anchor" href="#total-params-108343-trainable-params-108343-non-trainable-params-0-4"></a>Total params: 108,343<br>
Trainable params: 108,343<br>
Non-trainable params: 0</h1>

ptrblck: <p>It works for me using the latest <code>torchinfo</code> version:</p>
<pre data-code-wrap="python"><code class="lang-python">from torchinfo import summary

model = models.resnet18()
batch_size = 16
summary(model, input_size=(batch_size, 3, 224, 224))
# ==========================================================================================
# Layer (type:depth-idx)                   Output Shape              Param #
# ==========================================================================================
# ResNet                                   [16, 1000]                --
# ├─Conv2d: 1-1                            [16, 64, 112, 112]        9,408
# ├─BatchNorm2d: 1-2                       [16, 64, 112, 112]        128
# ├─ReLU: 1-3                              [16, 64, 112, 112]        --
# ├─MaxPool2d: 1-4                         [16, 64, 56, 56]          --
# ├─Sequential: 1-5                        [16, 64, 56, 56]          --
# │    └─BasicBlock: 2-1                   [16, 64, 56, 56]          --
# │    │    └─Conv2d: 3-1                  [16, 64, 56, 56]          36,864
# ...
# │    │    └─ReLU: 3-51                   [16, 512, 7, 7]           --
# ├─AdaptiveAvgPool2d: 1-9                 [16, 512, 1, 1]           --
# ├─Linear: 1-10                           [16, 1000]                513,000
# ==========================================================================================
# Total params: 11,689,512
# Trainable params: 11,689,512
# Non-trainable params: 0
# Total mult-adds (G): 29.03
# ==========================================================================================
# Input size (MB): 9.63
# Forward/backward pass size (MB): 635.96
# Params size (MB): 46.76
# Estimated Total Size (MB): 692.35
# ==========================================================================================
</code></pre>

maycaj: <p>Not sure if this is going to help, but it was working originally. Then something changed (not sure what) and it doesn’t show it anymore.</p>