ptrblck:

model.apply(xavier_init)


Actually, I am using argparse. for importing my custom Resnet. If I understood, model.apply or (I think in my case net.apply should be in the main code where I have net = models.__dict__[args.model](num_classes), while xavier_init function has to be in the model.py (where the model is, I mean in a separate .py file). My question is, I have to put the model in the main .py file for using model.apply or there is a way that I keep separate .py files for main and model and still using model.apply?