sksq96 / pytorch-summary

Model summary in PyTorch similar to `model.summary()` in Keras
MIT License
3.98k stars 412 forks source link

Issues about the setting of batchsize! Maybe it could be not only set to 2. #190

Closed RSMung closed 1 year ago

RSMung commented 1 year ago

https://github.com/sksq96/pytorch-summary/blob/345d898d84507b848e92dab4629e03405e19afce/torchsummary/torchsummary.py#L59 Question1: In this line code, you just set the sample batchsize to 2, maybe it's a mistake, could you modify it from 2 to batchsize? Just like this: x = [torch.rand(batch_size, *in_size).type(dtype) for in_size in input_size]

Question2: I find out that if my model has input that needs to be None, summary function can't work out, can you fix it? My model's forward function is just like this: def forward(self, x1, x2, x3=None, x4=None): do something or like this: def forward(self, x1, x2=None, x3, x4=None): do something

Waiting for your reply! Thank you very much.