'ResNet' object has no attribute 'named_buffers'

Hi,
I tried to build a resnet50 network and wanna get the buffers inside the network, i.e. running means and variances. But when using method named_buffers which is defined in https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/module.py#L810-L834, an AttributeError comes out telling me that ‘ResNet’ object has no attribute ‘named_buffers’. I also tried method named_parameters which works fine. I am curious about the reason of it.

Thanks.

I’m not sure, but AFAIK, named_buffers and buffers are relatively new methods (corresponding PR).
Also, resnet models are available before these 2 methods are merged.

Thank you for your reply. I find it raises error in 0.4.1 and 0.5.0a0+3cb45ba, but works fine in 0.5.0a0+82aeebb.

1 Like