code: def translations_to_projective_transforms(
      translations: TensorLike, name: Optional[str] = None
  ) -> tf.Tensor:
      """Returns projective transform(s) for the given translation(s).
  
      Args:
          translations: A 2-element list representing `[dx, dy]` or a matrix of
              2-element lists representing `[dx, dy]` to translate for each image
              (for a batch of images). The rank must be statically known
              (the shape is not `TensorShape(None)`).
          name: The name of the op.
      Returns:
          A tensor of shape `(num_images, 8)` projective transforms which can be
          given to `tfa.image.transform`.
      """
      with tf.name_scope(
          name or "translations_to_projective_transforms"
      ):
          translation_or_translations = tf.convert_to_tensor(
              translations, name="translations", dtype=tf.dtypes.float32
          )
          if translation_or_translations.get_shape().ndims is None:
              raise TypeError(
                  "translation_or_translations rank must be statically known"
              )
          elif len(translation_or_translations.get_shape()) == 1:
              translations = translation_or_translations[None]
          elif len(translation_or_translations.get_shape()) == 2:
              translations = translation_or_translations
          else:
              raise TypeError("Translations should have rank 1 or 2.")
          num_translations = tf.shape(translations)[0]
          # The translation matrix looks like:
          #     [[1 0 -dx]
          #      [0 1 -dy]
          #      [0 0 1]]
          # where the last entry is implicit.
          # Translation matrices are always float32.
          return tf.concat(
              values=[
                  tf.ones((num_translations, 1), tf.dtypes.float32),
                  tf.zeros((num_translations, 1), tf.dtypes.float32),
                  -translations[:, 0, None],
                  tf.zeros((num_translations, 1), tf.dtypes.float32),
                  tf.ones((num_translations, 1), tf.dtypes.float32),
                  -translations[:, 1, None],
                  tf.zeros((num_translations, 2), tf.dtypes.float32),
              ],
              axis=1,
          )
  
file_path: addons/tensorflow_addons/image/translate_ops.py
imports: import tensorflow
  from tensorflow_addons.image.transform_ops import transform
  from tensorflow_addons.image.utils import wrap, unwrap
  from tensorflow_addons.utils.types import TensorLike
  from typing import Optional
label_desc: Use image node_id 1 for calling a global function with example usage: translations_to_projective_transforms(translations, name) and returns: tf