sksq96 / pytorch-summary

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

how to pass other parameter in forward #153

Open joshylchen opened 3 years ago

joshylchen commented 3 years ago

For example in the forward path, I define as def forward(self, input, path1=True):

I realize that when I want to pass summary(model, [(3, 32,32),(True)]) or summary(model, [(3, 32,32),(True)] or summary(model, [(3, 32,32),True]) or summary(model, ((3, 32,32),True))

It either reported as argument must be an iterate or size must be tuple of ints. How could I resolve this to pass other parameters?

Thank you

PANhuihuihuihui commented 3 years ago

you may refer to the original code and adjust it if you want to let this package could pass other parameter.

batch_size of 2 for batchnorm x = [torch.rand(2, *in_size).type(dtype).to(device=device) for in_size, dtype in zip(input_size, dtypes)]

model(*x)