def METHOD_NAME(self, batch):
    img = batch['image']
    predicted_img = batch[self.image_to_discriminator]
    original_mask = batch['mask']
    supervised_mask = batch['mask_for_losses']
    # L1
    l1_value = masked_l1_loss(predicted_img, img, supervised_mask,
                              self.losses_l1_weight_known,
                              self.losses_l1_weight_missing)
    total_loss = l1_value
    metrics = dict(gen_l1=l1_value)
    # discriminator
    # adversarial_loss calls backward by itself
    mask_for_discr = supervised_mask if self.distance_weighted_mask_for_discr else original_mask
    self.adversarial_loss.pre_generator_step(
        real_batch=img,
        fake_batch=predicted_img,
        generator=self.generator,
        discriminator=self.discriminator)
    discr_real_pred, discr_real_features = self.discriminator(img)
    discr_fake_pred, discr_fake_features = self.discriminator(
        predicted_img)
    adv_gen_loss, adv_metrics = self.adversarial_loss.METHOD_NAME(
        real_batch=img,
        fake_batch=predicted_img,
        discr_real_pred=discr_real_pred,
        discr_fake_pred=discr_fake_pred,
        mask=mask_for_discr)
    total_loss = total_loss + adv_gen_loss
    metrics['gen_adv'] = adv_gen_loss
    metrics.update(add_prefix_to_keys(adv_metrics, 'adv_'))
    # feature matching
    if self.feature_matching_weight > 0:
        need_mask_in_fm = False
        mask_for_fm = supervised_mask if need_mask_in_fm else None
        fm_value = feature_matching_loss(
            discr_fake_features, discr_real_features,
            mask=mask_for_fm) * self.feature_matching_weight
        total_loss = total_loss + fm_value
        metrics['gen_fm'] = fm_value
    if self.loss_resnet_pl is not None:
        resnet_pl_value = self.loss_resnet_pl(predicted_img, img)
        total_loss = total_loss + resnet_pl_value
        metrics['gen_resnet_pl'] = resnet_pl_value
    return total_loss, metrics