@force_fp32(apply_to=('cls_score', 'bbox_pred', 'dis_pred'))
def get_bboxes(self, rois, cls_score, bbox_pred, dis_pred, img_shape, scale_factor, rescale=False, cfg=None):
    if isinstance(cls_score, list):
        cls_score = (sum(cls_score) / float(len(cls_score)))
    scores = (F.softmax(cls_score, dim=1) if (cls_score is not None) else None)
    if (bbox_pred is not None):
        bboxes = self.bbox_coder.decode(rois[:, 1:], bbox_pred, max_shape=img_shape)
    else:
        bboxes = rois[:, 1:].clone()
        if (img_shape is not None):
            bboxes[:, [0, 2]].clamp_(min=0, max=img_shape[1])
            bboxes[:, [1, 3]].clamp_(min=0, max=img_shape[0])
    if (rescale and (bboxes.size(0) > 0)):
        if isinstance(scale_factor, float):
            bboxes /= scale_factor
        else:
            scale_factor = bboxes.new_tensor(scale_factor)
            bboxes = (bboxes.view(bboxes.size(0), (- 1), 4) / scale_factor).view(bboxes.size()[0], (- 1))
    if (dis_pred is not None):
        if ((self.dis_selector == 0) or (self.dis_selector == 1)):
            diseases = F.sigmoid(dis_pred)
        elif (self.dis_selector == 2):
            diseases = F.softmax(dis_pred, dim=1)
    if (cfg is None):
        return (bboxes, scores, diseases)
    else:
        (det_bboxes, det_labels, inds) = multiclass_nms(bboxes, scores, cfg.score_thr, cfg.nms, cfg.max_per_img, return_inds=True)
        if ((self.dis_selector == 0) or (self.dis_selector == 1)):
            diseases = diseases.expand(bboxes.size(0), (scores.size(1) - 1))
            diseases = diseases.reshape((- 1))
        elif (self.dis_selector == 2):
            diseases = diseases[:, None].expand(bboxes.size(0), (scores.size(1) - 1), 4)
            diseases = diseases.reshape((- 1), 4)
        det_dis = diseases[inds]
        return (det_bboxes, det_labels, det_dis)
@force_fp32(apply_to=('cls_score', 'bbox_pred', 'dis_pred'))
def get_bboxes(self, rois, cls_score, bbox_pred, dis_pred, img_shape, scale_factor, rescale=False, cfg=None):
    if isinstance(cls_score, list):
        cls_score = (sum(cls_score) / float(len(cls_score)))
    scores = (F.softmax(cls_score, dim=1) if (cls_score is not None) else None)
    if (bbox_pred is not None):
        bboxes = self.bbox_coder.decode(rois[:, 1:], bbox_pred, max_shape=img_shape)
    else:
        bboxes = rois[:, 1:].clone()
        if (img_shape is not None):
            bboxes[:, [0, 2]].clamp_(min=0, max=img_shape[1])
            bboxes[:, [1, 3]].clamp_(min=0, max=img_shape[0])
    if (rescale and (bboxes.size(0) > 0)):
        if isinstance(scale_factor, float):
            bboxes /= scale_factor
        else:
            scale_factor = bboxes.new_tensor(scale_factor)
            bboxes = (bboxes.view(bboxes.size(0), (- 1), 4) / scale_factor).view(bboxes.size()[0], (- 1))
    if (dis_pred is not None):
        if ((self.dis_selector == 0) or (self.dis_selector == 1)):
            diseases = F.sigmoid(dis_pred)
        elif (self.dis_selector == 2):
            diseases = F.softmax(dis_pred, dim=1)
    if (cfg is None):
        return (bboxes, scores, diseases)
    else:
        (det_bboxes, det_labels, inds) = multiclass_nms(bboxes, scores, cfg.score_thr, cfg.nms, cfg.max_per_img, return_inds=True)
        if ((self.dis_selector == 0) or (self.dis_selector == 1)):
            diseases = diseases.expand(bboxes.size(0), (scores.size(1) - 1))
            diseases = diseases.reshape((- 1))
        elif (self.dis_selector == 2):
            diseases = diseases[:, None].expand(bboxes.size(0), (scores.size(1) - 1), 4)
            diseases = diseases.reshape((- 1), 4)
        det_dis = diseases[inds]
        return (det_bboxes, det_labels, det_dis)