def forward(self, outputs, batch):
    '\n        :param outputs:\n        :param batch:\n        :return:\n        '
    opt = self.opt
    (hm_loss, wh_loss, off_loss, id_loss) = (0.0, 0.0, 0.0, 0.0)
    for s in range(opt.num_stacks):
        output = outputs[s]
        if (not opt.mse_loss):
            output['hm'] = _sigmoid(output['hm'])
        hm_loss += (self.crit(output['hm'], batch['hm']) / opt.num_stacks)
        if (opt.wh_weight > 0):
            if opt.dense_wh:
                mask_weight = (batch['dense_wh_mask'].sum() + 0.0001)
                wh_loss += ((self.crit_wh((output['wh'] * batch['dense_wh_mask']), (batch['dense_wh'] * batch['dense_wh_mask'])) / mask_weight) / opt.num_stacks)
            else:
                wh_loss += (self.crit_reg(output['wh'], batch['reg_mask'], batch['ind'], batch['wh']) / opt.num_stacks)
        if (opt.reg_offset and (opt.off_weight > 0)):
            off_loss += (self.crit_reg(output['reg'], batch['reg_mask'], batch['ind'], batch['reg']) / opt.num_stacks)
        if (opt.id_weight > 0):
            id_head = _tranpose_and_gather_feat(output['id'], batch['ind'])
            id_head = id_head[(batch['reg_mask'] > 0)].contiguous()
            id_head = (self.emb_scale * F.normalize(id_head))
            id_target = batch['ids'][(batch['reg_mask'] > 0)]
            id_output = self.classifier.forward(id_head).contiguous()
            id_loss += self.IDLoss(id_output, id_target)
    det_loss = (((opt.hm_weight * hm_loss) + (opt.wh_weight * wh_loss)) + (opt.off_weight * off_loss))
    loss = (((torch.exp((- self.s_det)) * det_loss) + (torch.exp((- self.s_id)) * id_loss)) + (self.s_det + self.s_id))
    loss *= 0.5
    loss_stats = {'loss': loss, 'hm_loss': hm_loss, 'wh_loss': wh_loss, 'off_loss': off_loss, 'id_loss': id_loss}
    return (loss, loss_stats)
:param outputs:
:param batch:
:return:
def forward(self, outputs, batch):
    '\n        :param outputs:\n        :param batch:\n        :return:\n        '
    opt = self.opt
    (hm_loss, wh_loss, off_loss, id_loss) = (0.0, 0.0, 0.0, 0.0)
    for s in range(opt.num_stacks):
        output = outputs[s]
        if (not opt.mse_loss):
            output['hm'] = _sigmoid(output['hm'])
        hm_loss += (self.crit(output['hm'], batch['hm']) / opt.num_stacks)
        if (opt.wh_weight > 0):
            if opt.dense_wh:
                mask_weight = (batch['dense_wh_mask'].sum() + 0.0001)
                wh_loss += ((self.crit_wh((output['wh'] * batch['dense_wh_mask']), (batch['dense_wh'] * batch['dense_wh_mask'])) / mask_weight) / opt.num_stacks)
            else:
                wh_loss += (self.crit_reg(output['wh'], batch['reg_mask'], batch['ind'], batch['wh']) / opt.num_stacks)
        if (opt.reg_offset and (opt.off_weight > 0)):
            off_loss += (self.crit_reg(output['reg'], batch['reg_mask'], batch['ind'], batch['reg']) / opt.num_stacks)
        if (opt.id_weight > 0):
            id_head = _tranpose_and_gather_feat(output['id'], batch['ind'])
            id_head = id_head[(batch['reg_mask'] > 0)].contiguous()
            id_head = (self.emb_scale * F.normalize(id_head))
            id_target = batch['ids'][(batch['reg_mask'] > 0)]
            id_output = self.classifier.forward(id_head).contiguous()
            id_loss += self.IDLoss(id_output, id_target)
    det_loss = (((opt.hm_weight * hm_loss) + (opt.wh_weight * wh_loss)) + (opt.off_weight * off_loss))
    loss = (((torch.exp((- self.s_det)) * det_loss) + (torch.exp((- self.s_id)) * id_loss)) + (self.s_det + self.s_id))
    loss *= 0.5
    loss_stats = {'loss': loss, 'hm_loss': hm_loss, 'wh_loss': wh_loss, 'off_loss': off_loss, 'id_loss': id_loss}
    return (loss, loss_stats)