Not able to vie output with input_data in pytorch summary

Flying-flash: <h1>
<a name="hi-i-am-trying-to-look-at-the-output-size-column-in-the-model-summary-however-i-am-getting-an-error-when-i-am-using-command-summarymodelinput_size768depth1batch_dim1-dtypestorchinttensor-i-am-getting-below-output-1" class="anchor" href="#hi-i-am-trying-to-look-at-the-output-size-column-in-the-model-summary-however-i-am-getting-an-error-when-i-am-using-command-summarymodelinput_size768depth1batch_dim1-dtypestorchinttensor-i-am-getting-below-output-1"></a>Hi,<br>
I am trying to look at the output size column in the model summary however I am getting an error.<br>
When I am using command:<br>
summary(model,input_size=(768,),depth=1,batch_dim=1, dtypes=[‘torch.IntTensor’])<br>
I am getting below output:</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="bertmodel-1-1-108310272-batchnorm1d-1-2-1536-linear-1-3-393728-relu-1-4-batchnorm1d-1-5-1024-linear-1-6-131328-relu-1-7-batchnorm1d-1-8-512-linear-1-9-32896-relu-1-10-batchnorm1d-1-11-256-linear-1-12-8256-relu-1-13-batchnorm1d-1-14-128-linear-1-15-2080-relu-1-16-batchnorm1d-1-17-64-linear-1-18-528-relu-1-19-batchnorm1d-1-20-32-linear-1-21-136-relu-1-22-batchnorm1d-1-23-16-linear-1-24-36-relu-1-25-batchnorm1d-1-26-8-linear-1-27-10-relu-1-28-3" class="anchor" href="#bertmodel-1-1-108310272-batchnorm1d-1-2-1536-linear-1-3-393728-relu-1-4-batchnorm1d-1-5-1024-linear-1-6-131328-relu-1-7-batchnorm1d-1-8-512-linear-1-9-32896-relu-1-10-batchnorm1d-1-11-256-linear-1-12-8256-relu-1-13-batchnorm1d-1-14-128-linear-1-15-2080-relu-1-16-batchnorm1d-1-17-64-linear-1-18-528-relu-1-19-batchnorm1d-1-20-32-linear-1-21-136-relu-1-22-batchnorm1d-1-23-16-linear-1-24-36-relu-1-25-batchnorm1d-1-26-8-linear-1-27-10-relu-1-28-3"></a>├─BertModel: 1-1                         108,310,272<br>
├─BatchNorm1d: 1-2                       1,536<br>
├─Linear: 1-3                            393,728<br>
├─ReLU: 1-4                              –<br>
├─BatchNorm1d: 1-5                       1,024<br>
├─Linear: 1-6                            131,328<br>
├─ReLU: 1-7                              –<br>
├─BatchNorm1d: 1-8                       512<br>
├─Linear: 1-9                            32,896<br>
├─ReLU: 1-10                             –<br>
├─BatchNorm1d: 1-11                      256<br>
├─Linear: 1-12                           8,256<br>
├─ReLU: 1-13                             –<br>
├─BatchNorm1d: 1-14                      128<br>
├─Linear: 1-15                           2,080<br>
├─ReLU: 1-16                             –<br>
├─BatchNorm1d: 1-17                      64<br>
├─Linear: 1-18                           528<br>
├─ReLU: 1-19                             –<br>
├─BatchNorm1d: 1-20                      32<br>
├─Linear: 1-21                           136<br>
├─ReLU: 1-22                             –<br>
├─BatchNorm1d: 1-23                      16<br>
├─Linear: 1-24                           36<br>
├─ReLU: 1-25                             –<br>
├─BatchNorm1d: 1-26                      8<br>
├─Linear: 1-27                           10<br>
├─ReLU: 1-28                             –</h1>
<h1>
<a name="total-params-108882846-trainable-params-108882846-non-trainable-params-0-4" class="anchor" href="#total-params-108882846-trainable-params-108882846-non-trainable-params-0-4"></a>Total params: 108,882,846<br>
Trainable params: 108,882,846<br>
Non-trainable params: 0</h1>
<p>However when I am trying with input data same model I am getting a n error:<br>
a = torch.randn(768,)<br>
summary(<br>
model,<br>
input_data = a, depth=1,batch_dim=1,col_names=[“kernel_size”, “output_size”, “num_params”, “mult_adds”],<br>
)<br>
Error:</p>
<p>TypeError                                 Traceback (most recent call last)<br>
~/anaconda3/envs/pytorch/lib/python3.9/site-packages/torchsummary/torchsummary.py in summary(model, input_data, batch_dim, branching, col_names, col_width, depth, device, dtypes, verbose, *args, **kwargs)<br>
139             with torch.no_grad():<br>
 → 140                 _ = model.to(device)(*x, *args, **kwargs)  # type: ignore[misc]<br>
141         except Exception as e:</p>
<p>~/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)<br>
726         else:<br>
 → 727             result = self.forward(*input, **kwargs)<br>
728         for hook in itertools.chain(</p>
<p>TypeError: forward() missing 1 required positional argument: ‘mask’</p>
<p>The above exception was the direct cause of the following exception:</p>
<p>RuntimeError                              Traceback (most recent call last)<br>
/tmp/ipykernel_1261328/3393389649.py in <br>
----&gt; 1 summary(<br>
2     model,<br>
3     input_data = a, depth=1,batch_dim=1,col_names=[“kernel_size”, “output_size”, “num_params”, “mult_adds”],<br>
4     )</p>
<p>~/anaconda3/envs/pytorch/lib/python3.9/site-packages/torchsummary/torchsummary.py in summary(model, input_data, batch_dim, branching, col_names, col_width, depth, device, dtypes, verbose, *args, **kwargs)<br>
141         except Exception as e:<br>
142             executed_layers = [layer for layer in summary_list if layer.executed]<br>
 → 143             raise RuntimeError(<br>
144                 "Failed to run torchsummary. See above stack traces for more details. "<br>
145                 “Executed layers up to: {}”.format(executed_layers)</p>
<p>RuntimeError: Failed to run torchsummary. See above stack traces for more details. Executed layers up to: []</p>
<p>It would be really helpful if you could provide your valuable inputs <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>