It’s weight initialization code below:
import torch.nn.init as init

def xavier(param):
    init.xavier_uniform(param)
def weights_init(m):
    if isinstance(m, nn.Conv2d):
        xavier(m.weight.data)
        m.bias.data.zero_()

if VGG is a nn.ModuleList, and:
    VGG.apply(weights_init)

dosen’t throw an error.
But I just can’t find any documentation or statement about this .apply() function. Where could I find it?
Thanks a lot.