code: def angles_to_projective_transforms(
      angles: TensorLike,
      image_height: TensorLike,
      image_width: TensorLike,
      name: Optional[str] = None,
  ) -> tf.Tensor:
      """Returns projective transform(s) for the given angle(s).
  
      Args:
        angles: A scalar angle to rotate all images by, or (for batches of
          images) a vector with an angle to rotate each image in the batch. The
          rank must be statically known (the shape is not `TensorShape(None)`.
        image_height: Height of the image(s) to be transformed.
        image_width: Width of the image(s) to be transformed.
  
      Returns:
        A tensor of shape (num_images, 8). Projective transforms which can be
        given to `transform` op.
      """
      with tf.name_scope(name or "angles_to_projective_transforms"):
          angle_or_angles = tf.convert_to_tensor(
              angles, name="angles", dtype=tf.dtypes.float32
          )
          if len(angle_or_angles.get_shape()) == 0:
              angles = angle_or_angles[None]
          elif len(angle_or_angles.get_shape()) == 1:
              angles = angle_or_angles
          else:
              raise ValueError("angles should have rank 0 or 1.")
          cos_angles = tf.math.cos(angles)
          sin_angles = tf.math.sin(angles)
          x_offset = (
              (image_width - 1)
              - (
                  cos_angles * (image_width - 1)
                  - sin_angles * (image_height - 1)
              )
          ) / 2.0
          y_offset = (
              (image_height - 1)
              - (
                  sin_angles * (image_width - 1)
                  + cos_angles * (image_height - 1)
              )
          ) / 2.0
          num_angles = tf.shape(angles)[0]
          return tf.concat(
              values=[
                  cos_angles[:, None],
                  -sin_angles[:, None],
                  x_offset[:, None],
                  sin_angles[:, None],
                  cos_angles[:, None],
                  y_offset[:, None],
                  tf.zeros((num_angles, 2), tf.dtypes.float32),
              ],
              axis=1,
          )
  
file_path: addons/tensorflow_addons/image/transform_ops.py
imports: import tensorflow
  from tensorflow_addons.image import utils
  from tensorflow_addons.utils.types import TensorLike
  from tensorflow_addons.image.utils import wrap, unwrap
  from typing import Optional
label_desc: Use image node_id 5 for calling a global function with example usage: angles_to_projective_transforms(angles, image_height, image_width, name) and returns: tf