TylerYep / torchinfo

View model summaries in PyTorch!
MIT License
2.56k stars 119 forks source link

AttributeError: 'list' object has no attribute 'size' #139

Closed roboserg closed 2 years ago

roboserg commented 2 years ago

image

Maybe I supply the wrong input_size? My model:

image

roboserg commented 2 years ago

I also tried using the batch_size:

image

TylerYep commented 2 years ago

Can you post your full model code? Your model likely accepts a list instead of a tensor as input. Try using the input_data param instead with your actual input data tensor for better results.

roboserg commented 2 years ago

Here you go - https://colab.research.google.com/drive/1wF3XyaN_WL7mR0qmWj6w7--pCC6TCYUF?usp=sharing

I changed the model to YOLOX and now getting a different error - image

Is there a way to not supply input size at all? In Keras the summary is printed automatically, without figuring out the input size

TylerYep commented 2 years ago

You should be using pip install torchinfo, not torchsummary.

Yes, you can just not pass the input_size parameter and get some limited results.

If your forward function needs additional parameters, you should pass them as kwargs:

summary(model, input_size=(3, 512, 512), img_metas=...)

TylerYep commented 2 years ago

Closed due to inactivity