def build_model(args): model = define_Gen(input_nc=1, output_nc=1, ngf=args.num_chans, netG=args.netG, norm='instance', drop_prob=args.drop_prob) model = model.to(args.device) return model
def load_model(checkpoint_file, netG): checkpoint = torch.load(checkpoint_file) args = checkpoint['args'] model = define_Gen(input_nc=1, output_nc=1, ngf=args.num_chans, netG=netG, norm='instance', drop_prob=0.0) model = model.to(args.device) if args.data_parallel: model = torch.nn.DataParallel(model) model.load_state_dict(checkpoint['model']) return model