[Feature Request] Show children names as well
See original GitHub issuesummary 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:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
I just added this today in version 0.1.0! You can add the layer names via: