def init(): base_path = os.path.dirname(__file__) os.environ["CUDA_VISIBLE_DEVICES"] = "0" dd = pdb.set_trace try: os.makedirs(os.path.join(base_path, args.outf)) except OSError: pass print(torch.cuda.is_available()) if torch.cuda.is_available() and not args.cuda: print( "WARNING: You have a CUDA device, so you should probably run with --cuda" ) G_xvz = _G_xvz() G_vzx = _G_vzx() train_list = os.path.join(base_path, args.data_list) train_loader = torch.utils.data.DataLoader(data_loader_evaluate.ImageList( train_list, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ])), batch_size=args.batch_size, shuffle=False, num_workers=args.workers, pin_memory=True) x = torch.FloatTensor(args.batch_size, 3, 128, 128) x_bar_bar_out = torch.FloatTensor(10, 3, 128, 128) v_siz = 9 z_siz = 128 - v_siz v = torch.FloatTensor(args.batch_size, v_siz) z = torch.FloatTensor(args.batch_size, z_siz) if args.cuda: G_xvz = torch.nn.DataParallel(G_xvz).cuda() G_vzx = torch.nn.DataParallel(G_vzx).cuda() x = x.cuda() x_bar_bar_out = x_bar_bar_out.cuda() v = v.cuda() z = z.cuda() x = Variable(x) x_bar_bar_out = Variable(x_bar_bar_out) v = Variable(v) z = Variable(z) load_pretrained_model(G_xvz, os.path.join(base_path, args.modelf), 'netG_xvz.pth') load_pretrained_model(G_vzx, os.path.join(base_path, args.modelf), 'netG_vzx.pth') batch_size = args.batch_size cudnn.benchmark = True G_xvz.eval() G_vzx.eval() return x, v, z, x_bar_bar_out, G_xvz, G_vzx, batch_size, train_loader
args = parser.parse_args() print(args) try: os.makedirs(args.outf) except OSError: pass if torch.cuda.is_available() and not args.cuda: print( "WARNING: You have a CUDA device, so you should probably run with --cuda" ) # need initialize!! G_xvz = _G_xvz() G_vzx = _G_vzx() D_xvs = _D_xvs() G_xvz.apply(weights_init) G_vzx.apply(weights_init) D_xvs.apply(weights_init) train_list = args.data_list train_loader = torch.utils.data.DataLoader(data_loader.ImageList( train_list, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ])), batch_size=args.batch_size,
args = parser.parse_args() print(args) try: os.makedirs(args.outf) except OSError: pass if torch.cuda.is_available() and not args.cuda: print( "WARNING: You have a CUDA device, so you should probably run with --cuda" ) # need initialize!! G_xvz_random = _G_xvz() G_xvz_SP = _G_xvz() G_vzx_random = _G_vzx() G_vzx_SP = _G_vzx() train_list = args.data_list train_loader = torch.utils.data.DataLoader(data_loader_evaluate.ImageList( train_list, transform=transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ])), batch_size=args.batch_size, shuffle=False, num_workers=args.workers,