Hello, I am currently learning to modify architecture of a model on pytorch and encounter some problem when using pytorch summary. I always get output of my model’s architecture followed by typeerror
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 64, 64] 3,136
Conv2d-2 [-1, 128, 32, 32] 131,200
BatchNorm2d-3 [-1, 128, 32, 32] 256
LeakyReLU-4 [-1, 128, 32, 32] 0
Conv2d-5 [-1, 256, 16, 16] 524,544
BatchNorm2d-6 [-1, 256, 16, 16] 512
LeakyReLU-7 [-1, 256, 16, 16] 0
Conv2d-8 [-1, 256, 8, 8] 1,048,832
BatchNorm2d-9 [-1, 256, 8, 8] 512
LeakyReLU-10 [-1, 256, 8, 8] 0
Conv2d-11 [-1, 256, 4, 4] 1,048,832
BatchNorm2d-12 [-1, 256, 4, 4] 512
LeakyReLU-13 [-1, 256, 4, 4] 0
Linear-14 [-1, 256] 1,048,832
Traceback (most recent call last):
File “main_gen_pseudo-data.py”, line 149, in
main()
File “main_gen_pseudo-data.py”, line 110, in main
summary(skipnet_model, (3, 128 , 128))
File “/home/cgal/anaconda3/envs/pytorch/lib/python3.7/site-packages/torchsummary/torchsummary.py”, line 93, in summary
total_output += np.prod(summary[layer][“output_shape”])
File “/home/cgal/anaconda3/envs/pytorch/lib/python3.7/site-packages/numpy/core/fromnumeric.py”, line 2772, in prod
initial=initial)
File “/home/cgal/anaconda3/envs/pytorch/lib/python3.7/site-packages/numpy/core/fromnumeric.py”, line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
TypeError: can’t multiply sequence by non-int of type ‘list’
I have already checked that the input during training is (16,3,128,128) and the command I use for summary is summary(skipnet_model, (3, 128 , 128))
. Can someone help me figure out this problem
This is the full architecture of my Skipnet link