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.

[Feature Request] Show children names as well

See original GitHub issue

summary should have the option (default?) to show module/layer names as well (not just class name). I.e. use named_children when traversing module children. e.g. in the following example should print something like:

‘block1’ [Sequential]: ‘conv1 [Conv2d]’ ‘relu1 [ReLU]’ ‘block2’ [Sequential]: ‘conv1 [Conv2d]’ ‘relu1 [ReLE]’

from collections import OrderedDict
import torch
from torch import nn
import torchinfo

class Model(nn.Module):
    def __init__(self):
        super().__init__()

        self.block1 = nn.Sequential(OrderedDict([
            ('conv1', nn.Conv2d(1, 8, 3, padding=1)),
            ('relu1', nn.ReLU())
            ]))
        self.block2 = nn.Sequential(OrderedDict([
            ('conv1', nn.Conv2d(8, 8, 3, padding=1)),
            ('relu1', nn.ReLU())
        ]))

    def forward(self, inputs):
        x = inputs['image']

        x = self.block1(x)
        x = self.block2(x)
        out = x.mean()

        return out


if __name__ == "__main__":
    model = Model()
    summary = torchinfo.summary(model)
    print(summary)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
m1procommented, Apr 3, 2021

For me it seems obvious. Different modules in the network have different functionalities. It makes it much more readable when the name of the sub module appears instead of just generic class name or Sequential. For example in computer vision models you can have feature extraction module, different heads of the same structure but different functionalities. For example Segmentation, classification, regressions. When one names a variable, one wants to see the name appear in a debugging windows not for example the address, right? 😉 And of course as the network grows bigger it makes it even harder when those labels are missing from the summary print.

0reactions
TylerYepcommented, May 8, 2021

I just added this today in version 0.1.0! You can add the layer names via:

torchinfo.summary(..., row_settings=["var_names", "depth"])
Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request List | Priddy Software
Feature Requests. General: Add a “Today” screen to show you what you need to do: hours, calls you scheduled, time you scheduled, a...
Read more >
Wikipedia:Ignored feature requests
Feature requests can be made at MediaZilla. For information on using MediaZilla, please see Wikipedia:Bug reports. You can discuss them first at m:MediaWiki ......
Read more >
Customizing Feature Request List Columns in Savio
Click the “Feature Request List Columns” dropdown for a number of column options. Choose the column you would like to display.
Read more >
Popular Baby Names - Social Security
Rank, Male name, Female name. 1, Liam, Olivia. 2, Noah, Emma. 3, Oliver, Charlotte. 4, Elijah, Amelia. 5, James, Ava. 6, William, Sophia....
Read more >
Feature Requests - Advanced Ads
On this page, you can request new features for the Advanced Ads plugin. Also, you can vote for existing feature requests.
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