question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

summary() missing 8 required keyword-only arguments

See original GitHub issue

Hello, I am trying to use summary() on a simple CNN function. However, I get the following TypeError:

TypeError: summary() missing 8 required keyword-only arguments: 'batch_dim', 'branching', 'col_names', 'col_width', 'depth', 'device', 'dtypes', and 'verbose'

I am using:

from torchsummary import summary
model = CNN().to(device)
summary(model, (3, 96, 96))

What is the correct execution?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wlcostacommented, Dec 9, 2020

Well, this is confusing. I restarted the kernel once again and it worked just fine:

==========================================================================================
Layer (type:depth-idx)                   Output Shape              Param #
==========================================================================================
├─Conv2d: 1-1                            [-1, 32, 26, 26]          896
├─Conv2d: 1-2                            [-1, 64, 24, 24]          18,496
├─Linear: 1-3                            [-1, 128]                 1,179,776
├─Linear: 1-4                            [-1, 10]                  1,290
==========================================================================================
Total params: 1,200,458
Trainable params: 1,200,458
Non-trainable params: 0
Total mult-adds (M): 12.38
==========================================================================================
Input size (MB): 0.01
Forward/backward pass size (MB): 0.45
Params size (MB): 4.58
Estimated Total Size (MB): 5.04
==========================================================================================

I am not sure what happened since I already restarted the kernel a few times. Thank you for your help! Best regards.

0reactions
wlcostacommented, Dec 9, 2020

Yeah, it should be (3, 28, 28). I changed it here, but the error persists. I’m still updating my environment to Python 3.8.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing 1 Required Keyword-Only Argument - Stack Overflow
You have defined a function with a variable amount of positional arguments, *rel_change , which can only ever be followed by keyword only...
Read more >
Keyword-only function arguments - Python Morsels
Let's define a function that accepts a keyword-only argument. ... The error says that greet is missing one required keyword-only argument ...
Read more >
Missing keyword only argument : r/Discord_Bots - Reddit
Came back to a program I havent touched for a week and when I run it I get TypeError: Client.__init__() missing 1 required...
Read more >
Keyword-only Arguments in Python - Medium
In this scenario, we just give the function a positional argument for ... You're missing 1 required keyword-only argument: separator.
Read more >
python function arguments - Pythoneasy
Keyword arguments allow us to match by name, instead of by position. def company(name, year, state, country): ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found