def __init__(self, opt=None): super(StyleContentLoss, self).__init__() self.vgg = VGG19().cuda() self.mse_loss = nn.MSELoss() self.mse_loss_sum = nn.MSELoss(reduction="sum") self.opt = opt
def __init__(self, gpu_ids): super(VGGLoss, self).__init__() self.vgg = VGG19().cuda() self.criterion = nn.L1Loss() self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]
def __init__(self, gpu_ids): super(VGGLoss, self).__init__() # modification: change the pretrained vgg network to only use cuda if enabled self.vgg = VGG19().cuda() if len(gpu_ids) > 0 else VGG19() self.criterion = nn.L1Loss() self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]