Unverified Commit 1b354097 authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

Update rescale tests - cast to float after rescaling to reflect #25229 (#25259)

Rescale tests - cast to float after rescaling to reflect #25229
parent 904e7e0f
......@@ -201,9 +201,9 @@ class EfficientNetImageProcessorTest(ImageProcessingSavingTestMixin, unittest.Te
image_processor = self.image_processing_class(**self.image_processor_dict)
rescaled_image = image_processor.rescale(image, scale=1 / 255)
expected_image = image.astype(np.float32) * (2 / 255.0) - 1
expected_image = (image * (2 / 255.0)).astype(np.float32) - 1
self.assertTrue(np.allclose(rescaled_image, expected_image))
rescaled_image = image_processor.rescale(image, scale=1 / 255, offset=False)
expected_image = image.astype(np.float32) / 255.0
expected_image = (image / 255.0).astype(np.float32)
self.assertTrue(np.allclose(rescaled_image, expected_image))
......@@ -220,9 +220,9 @@ class VivitImageProcessingTest(ImageProcessingSavingTestMixin, unittest.TestCase
image_processor = self.image_processing_class(**self.image_processor_dict)
rescaled_image = image_processor.rescale(image, scale=1 / 255)
expected_image = image.astype(np.float32) * (2 / 255.0) - 1
expected_image = (image * (2 / 255.0)).astype(np.float32) - 1
self.assertTrue(np.allclose(rescaled_image, expected_image))
rescaled_image = image_processor.rescale(image, scale=1 / 255, offset=False)
expected_image = image.astype(np.float32) / 255.0
expected_image = (image / 255.0).astype(np.float32)
self.assertTrue(np.allclose(rescaled_image, expected_image))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment