I want to use Xavier initialization scheme, for initializing weights, for Resnet in http://www.pabloruizruiz10.com/resources/CNNs/ResNet-PyTorch.html  6
So I added this in the network:
def xavier_init(ms):
       for m in ms :
            if isinstance(m, nn.Linear) or isinstance(m, nn.Conv2d):
                nn.init.xavier_uniform(m.weight,gain=nn.init.calculate_gain('relu'))
                m.bias.data.zero_()

and then calling this in the main code:
net.weight_init()

It is giving this error:
TypeError: ‘Conv2d’ object is not iterable

how can I solve this error?