    def run_on_image(self, inputs, graph_mode=False):
        """
        Call the AIT module for the inference of the model on given inputs, and return the outputs.
        """
        topk = self.cfg.POSTPROCESS.TOPK
        mod = self.module
        if type(inputs) is np.ndarray:
            arr = torch.from_numpy(inputs).cuda()
        else:
            arr = inputs.contiguous()

        inputs = [arr]

        outputs = [
            torch.empty([self.batch_size, 1], dtype=torch.int64).cuda(),
            torch.empty([self.batch_size, topk, 4]).cuda().half(),
            torch.empty([self.batch_size, topk]).cuda().half(),
            torch.empty([self.batch_size, topk], dtype=torch.int64).cuda(),
        ]
        if self.mask_on:
            mask_size = self.cfg.MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION * 2
            mask_blob = torch.empty([self.batch_size, topk, mask_size, mask_size])
            outputs.append(mask_blob.cuda().half())
        mod.run_with_tensors(inputs, outputs, graph_mode=graph_mode)

        ret = [
            outputs[1].cpu().numpy(),
            outputs[2].cpu().numpy(),
            outputs[3].cpu().numpy(),
        ]
        if self.mask_on:
            ret.append(outputs[-1].cpu().numpy())
        return ret
Call the AIT module for the inference of the model on given inputs, and return the outputs.
examples/02_detectron2/predictor/predictor.py