def __init__(self, cfg, model, tta_mapper=None):
        """
        Args:
            cfg (CfgNode):
            model (GeneralizedRCNN): a GeneralizedRCNN to apply TTA on.
            tta_mapper (callable): takes a dataset dict and returns a list of
                augmented versions of the dataset dict. Defaults to
                `DatasetMapperTTA(cfg)`.
            batch_size (int): batch the augmented images into this batch size for inference.
        """
        super().__init__()
        if isinstance(model, DistributedDataParallel):
            model = model.module
        assert isinstance(model, DD3D), "DD3DwithTTA only supports on DD3D. Got a model of type {}".format(type(model))
        assert not model.postprocess_in_inference, "To use test-time augmentation, `postprocess_in_inference` must be False."
        self.cfg = cfg.copy()

        self.model = model
        self.nms_thresh = cfg.DD3D.FCOS2D.INFERENCE.NMS_THRESH

        if tta_mapper is None:
            tta_mapper = DatasetMapperTTA(cfg)
        self.tta_mapper = tta_mapper
        self.batch_size = cfg.TEST.IMS_PER_BATCH // get_world_size()

        Args:
            cfg (CfgNode):
            model (GeneralizedRCNN): a GeneralizedRCNN to apply TTA on.
            tta_mapper (callable): takes a dataset dict and returns a list of
                augmented versions of the dataset dict. Defaults to
                `DatasetMapperTTA(cfg)`.
            batch_size (int): batch the augmented images into this batch size for inference.
        
tridet/modeling/dd3d/test_time_augmentation.py