def METHOD_NAME(self, x_natural, x_adv, vec_y):
    """
    calculate loss function for generation of adversarial images
    """
    x_adv.requires_grad_()
    with torch.enable_grad():
        logits_adv = self.cal_logit_y(x_adv)
        logits_natural = self.cal_logit_y(x_natural)
        prob_adv = F.log_softmax(logits_adv, dim=1)
        prob_natural = F.softmax(logits_natural, dim=1)
        loss_adv_gen_task = self.cal_task_loss(x_adv, vec_y)
        loss_adv_gen = self.loss4gen_adv(prob_adv, prob_natural)
    return loss_adv_gen + loss_adv_gen_task.sum()