(opt, modelG, modelD, flowNet)
| 8 | def lcm(a,b): return abs(a * b)/fractions.gcd(a,b) if a and b else 0 |
| 9 | |
| 10 | def wrap_model(opt, modelG, modelD, flowNet): |
| 11 | if opt.n_gpus_gen == len(opt.gpu_ids): |
| 12 | modelG = myModel(opt, modelG) |
| 13 | modelD = myModel(opt, modelD) |
| 14 | flowNet = myModel(opt, flowNet) |
| 15 | else: |
| 16 | if opt.batchSize == 1: |
| 17 | gpu_split_id = opt.n_gpus_gen + 1 |
| 18 | modelG = nn.DataParallel(modelG, device_ids=opt.gpu_ids[0:1]) |
| 19 | else: |
| 20 | gpu_split_id = opt.n_gpus_gen |
| 21 | modelG = nn.DataParallel(modelG, device_ids=opt.gpu_ids[:gpu_split_id]) |
| 22 | modelD = nn.DataParallel(modelD, device_ids=[opt.gpu_ids[0]] + opt.gpu_ids[gpu_split_id:]) |
| 23 | flowNet = nn.DataParallel(flowNet, device_ids=[opt.gpu_ids[0]] + opt.gpu_ids[gpu_split_id:]) |
| 24 | return modelG, modelD, flowNet |
| 25 | |
| 26 | class myModel(nn.Module): |
| 27 | def __init__(self, opt, model): |
no test coverage detected