Add check before int casting for PIL conversion (#21969)
* Add check before int casting for PIL conversion * Line length * Tidier logic
This commit is contained in:
@@ -96,6 +96,11 @@ class ImageTransformsTester(unittest.TestCase):
|
||||
# make sure image is correctly rescaled
|
||||
self.assertTrue(np.abs(np.asarray(pil_image)).sum() > 0)
|
||||
|
||||
# Make sure that an exception is raised if image is not in [0, 1]
|
||||
image = np.random.randn(*image_shape).astype(dtype)
|
||||
with self.assertRaises(ValueError):
|
||||
to_pil_image(image)
|
||||
|
||||
@require_tf
|
||||
def test_to_pil_image_from_tensorflow(self):
|
||||
# channels_first
|
||||
|
||||
Reference in New Issue
Block a user