docstr: Tests that we can reproduce the results of tfa_image.transform.
docstr_tok: ["Tests","that","we","can","reproduce","the","results","of","tfa_image.transform","."]
code: def test_perspective_transform_integer_centers_preset(
      self, dtype, interpolation
  ):
      """Tests that we can reproduce the results of tfa_image.transform."""
      image = tf.constant(
          (
              (1.0, 2.0, 3.0),
              (4.0, 5.0, 6.0),
              (7.0, 8.0, 9.0),
              (10.0, 11.0, 12.0),
          ),
          dtype=dtype,
      )
      scale = 3
      transformation = tf.constant(
          (
              (1.0 / scale, 0.0, 0.0),
              (0.0, 1.0 / scale, 0.0),
              (0.0, 0.0, 1.0),
          ),
          dtype=dtype,
      )
  
      image_shape = tf.shape(input=image)
      image_resized_shape = image_shape * scale
      image = image[tf.newaxis, ..., tf.newaxis]
      transformation = transformation[tf.newaxis, ...]
      image_resized = tfa_image.transform(
          tf.cast(image, tf.float32),
          tf.cast(
              tfa_image.transform_ops.matrices_to_flat_transforms(
                  transformation
              ),
              tf.float32,
          ),
          interpolation=interpolation,
          output_shape=image_resized_shape,
      )
      image_transformed = transformer.perspective_transform(
          image,
          transformation,
          resampling_type=transformer.ResamplingType.NEAREST
          if interpolation == "NEAREST"
          else transformer.ResamplingType.BILINEAR,
          pixel_type=transformer.PixelType.INTEGER,
          output_shape=image_resized_shape,
      )
  
      self.assertAllClose(image_resized, image_transformed)
  
file_path: graphics/tensorflow_graphics/image/tests/transformer_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_addons import image
  from tensorflow_graphics.image import transformer
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 4 for calling the TransformerTest obj's underlying member method code with example usage: obj.test_perspective_transform_integer_centers_preset(dtype, interpolation) without return types