Getting error when using print() or summary() in pytorch to see the layers and weight dimensions in a Pytorch model
When using print on an existing model,
it doesn't print the model. Instead it shows: 
&lt;function resnext101_32x8d at 0x00000178CC26BA68&gt;

&gt;&gt;&gt; import torch
&gt;&gt;&gt; import torchvision.models as models 
&gt;&gt;&gt; m1 = models.resnext101_32x8d
&gt;&gt;&gt; print(m1)
&lt;function resnext101_32x8d at 0x00000178CC26BA68&gt;
&gt;&gt;&gt;


When using summary, it gives the following error:


  AttributeError: 'function' object has no attribute 'apply'


&gt;&gt;&gt; import torch
&gt;&gt;&gt; import torchvision.models as models 
&gt;&gt;&gt; from torchvision import summary
&gt;&gt;&gt; m1 = models.resnext101_32x8d
&gt;&gt;&gt;
&gt;&gt;&gt; summary(m1, (3, 224, 224))
 Traceback(most recent call last):
   File "&lt;stdin&gt;", line 1, in &lt;module&gt;
   File torchsummary.py, line 68, in summary
      model.apply(register_hook)
AttributeError: 'function' object has no attribute 'apply'


How to fix these issues related to print and summary? Any other ways to easily see all pytorch layers and model topology?

models.resnext101_32x8d is the class constructor, you need to call the constructor, just add parentheses at the end. 

m1 = models.resnext101_32x8d()
print(m1)

