def loss(self, x, labels):
    (label_1, label_2) = labels
    result = self.forward(x)
    result.loss1 = self.task1.loss(result.out1, label_1)
    result.loss2 = self.task2.loss(result.out2, label_2)
    result.loss = (result.loss1 + (self.cfg.TRAIN.TASK2_FACTOR * result.loss2))
    if self.aux:
        result.aux_loss1 = self.task1.loss(result.aux1, label_1)
        result.aux_loss2 = self.task2.loss(result.aux2, label_2)
        result.aux_loss = (result.aux_loss1 + (self.cfg.TRAIN.TASK2_FACTOR * result.aux_loss2))
        result.aux_weight = poly(start=self.cfg.TRAIN.AUX_WEIGHT, end=0.0, steps=self._step, total_steps=self.cfg.TRAIN.STEPS, period=self.cfg.TRAIN.AUX_PERIOD, power=1.0)
        result.loss += (result.aux_weight * result.aux_loss)
    return result
def loss(self, x, labels):
    (label_1, label_2) = labels
    result = self.forward(x)
    result.loss1 = self.task1.loss(result.out1, label_1)
    result.loss2 = self.task2.loss(result.out2, label_2)
    result.loss = (result.loss1 + (self.cfg.TRAIN.TASK2_FACTOR * result.loss2))
    if self.aux:
        result.aux_loss1 = self.task1.loss(result.aux1, label_1)
        result.aux_loss2 = self.task2.loss(result.aux2, label_2)
        result.aux_loss = (result.aux_loss1 + (self.cfg.TRAIN.TASK2_FACTOR * result.aux_loss2))
        result.aux_weight = poly(start=self.cfg.TRAIN.AUX_WEIGHT, end=0.0, steps=self._step, total_steps=self.cfg.TRAIN.STEPS, period=self.cfg.TRAIN.AUX_PERIOD, power=1.0)
        result.loss += (result.aux_weight * result.aux_loss)
    return result