Not able to vie output with input_data in pytorch summary

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:
summary(model,input_size=(768,),depth=1,batch_dim=1, dtypes=[‘torch.IntTensor’])
I am getting below output:

Layer (type:depth-idx) Param #

├─BertModel: 1-1 108,310,272
├─BatchNorm1d: 1-2 1,536
├─Linear: 1-3 393,728
├─ReLU: 1-4 –
├─BatchNorm1d: 1-5 1,024
├─Linear: 1-6 131,328
├─ReLU: 1-7 –
├─BatchNorm1d: 1-8 512
├─Linear: 1-9 32,896
├─ReLU: 1-10 –
├─BatchNorm1d: 1-11 256
├─Linear: 1-12 8,256
├─ReLU: 1-13 –
├─BatchNorm1d: 1-14 128
├─Linear: 1-15 2,080
├─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 –

Total params: 108,882,846
Trainable params: 108,882,846
Non-trainable params: 0

However when I am trying with input data same model I am getting a n error:
a = torch.randn(768,)
summary(
model,
input_data = a, depth=1,batch_dim=1,col_names=[“kernel_size”, “output_size”, “num_params”, “mult_adds”],
)
Error:

TypeError Traceback (most recent call last)
~/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)
139 with torch.no_grad():
→ 140 _ = model.to(device)(*x, *args, **kwargs) # type: ignore[misc]
141 except Exception as e:

~/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
726 else:
→ 727 result = self.forward(*input, **kwargs)
728 for hook in itertools.chain(

TypeError: forward() missing 1 required positional argument: ‘mask’

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
/tmp/ipykernel_1261328/3393389649.py in
----> 1 summary(
2 model,
3 input_data = a, depth=1,batch_dim=1,col_names=[“kernel_size”, “output_size”, “num_params”, “mult_adds”],
4 )

~/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)
141 except Exception as e:
142 executed_layers = [layer for layer in summary_list if layer.executed]
→ 143 raise RuntimeError(
144 "Failed to run torchsummary. See above stack traces for more details. "
145 “Executed layers up to: {}”.format(executed_layers)

RuntimeError: Failed to run torchsummary. See above stack traces for more details. Executed layers up to: []

It would be really helpful if you could provide your valuable inputs :slight_smile: