def METHOD_NAME(self, cfg_file, devices):
    message_hub = MessageHub.get_instance(
        f'test_single_stage_forward_loss_mode-{time.time()}')
    message_hub.update_info('iter', 0)
    message_hub.update_info('epoch', 0)
    model = get_detector_cfg(cfg_file)
    model.backbone.init_cfg = None
    from mmdet.registry import MODELS
    assert all([device in ['cpu', 'cuda'] for device in devices])
    for device in devices:
        detector = MODELS.build(model)
        detector.init_weights()
        if device == 'cuda':
            if not torch.cuda.is_available():
                return unittest.skip('test requires GPU and torch+cuda')
            detector = detector.cuda()
        packed_inputs = demo_mm_inputs(2, [[3, 128, 128], [3, 125, 130]])
        data = detector.data_preprocessor(packed_inputs, True)
        losses = detector.forward(**data, mode='loss')
        self.assertIsInstance(losses, dict)