def identity(batched_image): self.assertTrue(utils.is_batched_image(batched_image)) return batched_image
def test_is_batched_image(self): batched_image = torch.zeros(1, 1, 1, 1) self.assertTrue(utils.is_batched_image(batched_image)) self.assertFalse(utils.is_batched_image(batched_image.byte())) self.assertFalse(utils.is_batched_image(batched_image.squeeze(0)))
def test_make_batched_image(self): single_image = torch.empty(1, 1, 1) batched_image = utils.make_batched_image(single_image) self.assertTrue(utils.is_batched_image(batched_image))
def test_read_image(self): actual = io.read_image(self.default_image_file()) desired = self.load_image() self.assertTrue(utils.is_batched_image(actual)) self.assertImagesAlmostEqual(actual, desired)