import torch.nn as nn def weights_init_D(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='leaky_relu') # nn.init.constant_(m.bias, 0) elif classname.find('BatchNorm') != -1: nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0) def weights_init_G(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='leaky_relu') # nn.init.constant_(m.bias, 0) elif classname.find('BatchNorm') != -1: nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0)