def test_image_loader(self):
     """
     Test that model correctly handles text task.
     """
     opt = ParlaiParser().parse_args([])
     opt.update(BASE_IMAGE_ARGS)
     for image_mode, dim in IMAGE_MODE_TO_DIM.items():
         opt["image_mode"] = image_mode
         teacher = create_task_agent_from_taskname(opt)[0]
         teacher_act = teacher.get(0)
         self.assertEquals(
             teacher_act["image"].size(),
             dim,
             f"dim mismatch for image mode {image_mode}",
         )
 def _base_test_loader(self, image_mode_partial: str, no_cuda: bool = False):
     """
     Test for given partial image mode.
     """
     opt = ParlaiParser().parse_args([])
     opt.update(BASE_IMAGE_ARGS)
     opt['no_cuda'] = no_cuda
     for image_mode, dim in IMAGE_MODE_TO_DIM.items():
         if image_mode_partial not in image_mode:
             continue
         opt["image_mode"] = image_mode
         teacher = create_task_agent_from_taskname(opt)[0]
         teacher_act = teacher.get(0)
         self.assertEquals(
             teacher_act["image"].size(),
             dim,
             f"dim mismatch for image mode {image_mode}",
         )
     torch.cuda.empty_cache()