07eeeac726b1b7f771e10909426663cc6bd0c477,models/networks.py,,define_D,#Any#Any#Any#Any#Any#Any#Any#Any#Any#,153
Before Change
norm="batch", nl="lrelu",
use_sigmoid=False, init_type="xavier", num_Ds=1, gpu_ids=[]):
netD = None
use_gpu = len(gpu_ids) > 0
norm_layer = get_norm_layer(layer_type=norm)
nl = "lrelu" // use leaky relu for D
nl_layer = get_non_linearity(layer_type=nl)
if use_gpu:
assert(torch.cuda.is_available())
if which_model_netD == "basic_128":
netD = D_NLayers(input_nc, ndf, n_layers=2, norm_layer=norm_layer,
nl_layer=nl_layer, use_sigmoid=use_sigmoid, gpu_ids=gpu_ids)
elif which_model_netD == "basic_256":
netD = D_NLayers(input_nc, ndf, n_layers=3, norm_layer=norm_layer,
nl_layer=nl_layer, use_sigmoid=use_sigmoid, gpu_ids=gpu_ids)
elif which_model_netD == "basic_128_multi":
netD = D_NLayersMulti(input_nc=input_nc, ndf=ndf, n_layers=2, norm_layer=norm_layer,
use_sigmoid=use_sigmoid, gpu_ids=gpu_ids, num_D=num_Ds)
elif which_model_netD == "basic_256_multi":
netD = D_NLayersMulti(input_nc=input_nc, ndf=ndf, n_layers=3, norm_layer=norm_layer,
use_sigmoid=use_sigmoid, gpu_ids=gpu_ids, num_D=num_Ds)
else:
raise NotImplementedError(
"Discriminator model name [%s] is not recognized" % which_model_netD)
if use_gpu:
netD.cuda(gpu_ids[0])
init_weights(netD, init_type=init_type)
return netD
def define_E(input_nc, output_nc, ndf, which_model_netE,
norm="batch", nl="lrelu",
After Change
def define_D(input_nc, ndf, which_model_netD,
norm="batch", nl="lrelu",
use_sigmoid=False, init_type="xavier", num_Ds=1, gpu_ids=[]):
netD = None
norm_layer = get_norm_layer(layer_type=norm)
nl = "lrelu" // use leaky relu for D
nl_layer = get_non_linearity(layer_type=nl)
if which_model_netD == "basic_128":
netD = D_NLayers(input_nc, ndf, n_layers=2, norm_layer=norm_layer,
nl_layer=nl_layer, use_sigmoid=use_sigmoid, gpu_ids=gpu_ids)
elif which_model_netD == "basic_256":
netD = D_NLayers(input_nc, ndf, n_layers=3, norm_layer=norm_layer,
nl_layer=nl_layer, use_sigmoid=use_sigmoid, gpu_ids=gpu_ids)
elif which_model_netD == "basic_128_multi":
netD = D_NLayersMulti(input_nc=input_nc, ndf=ndf, n_layers=2, norm_layer=norm_layer,
use_sigmoid=use_sigmoid, gpu_ids=gpu_ids, num_D=num_Ds)
elif which_model_netD == "basic_256_multi":
netD = D_NLayersMulti(input_nc=input_nc, ndf=ndf, n_layers=3, norm_layer=norm_layer,
use_sigmoid=use_sigmoid, gpu_ids=gpu_ids, num_D=num_Ds)
else:
raise NotImplementedError(
"Discriminator model name [%s] is not recognized" % which_model_netD)
return init_net(netD, init_type, gpu_ids)
def define_E(input_nc, output_nc, ndf, which_model_netE,
norm="batch", nl="lrelu",
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 10
Instances
Project Name: junyanz/BicycleGAN
Commit Name: 07eeeac726b1b7f771e10909426663cc6bd0c477
Time: 2018-05-24
Author: junyanzhu89@gmail.com
File Name: models/networks.py
Class Name:
Method Name: define_D
Project Name: richzhang/colorization-pytorch
Commit Name: 64bba81a6867ad72aad461e27221ea278d25f5c1
Time: 2018-04-18
Author: junyanzhu89@gmail.com
File Name: models/networks.py
Class Name:
Method Name: define_G
Project Name: junyanz/BicycleGAN
Commit Name: 07eeeac726b1b7f771e10909426663cc6bd0c477
Time: 2018-05-24
Author: junyanzhu89@gmail.com
File Name: models/networks.py
Class Name:
Method Name: define_E
Project Name: junyanz/BicycleGAN
Commit Name: 07eeeac726b1b7f771e10909426663cc6bd0c477
Time: 2018-05-24
Author: junyanzhu89@gmail.com
File Name: models/networks.py
Class Name:
Method Name: define_D