code: def flat_transforms_to_matrices(
      transforms: TensorLike, name: Optional[str] = None
  ) -> tf.Tensor:
      """Converts projective transforms to affine matrices.
  
      Note that the output matrices map output coordinates to input coordinates.
      For the forward transformation matrix, call `tf.linalg.inv` on the result.
  
      Args:
        transforms: Vector of length 8, or batches of transforms with shape
          `(N, 8)`.
        name: The name for the op.
  
      Returns:
        3D tensor of matrices with shape `(N, 3, 3)`. The output matrices map the
          *output coordinates* (in homogeneous coordinates) of each transform to
          the corresponding *input coordinates*.
  
      Raises:
        ValueError: If `transforms` have an invalid shape.
      """
      with tf.name_scope(name or "flat_transforms_to_matrices"):
          transforms = tf.convert_to_tensor(
              transforms, name="transforms"
          )
          if transforms.shape.ndims not in (1, 2):
              raise ValueError(
                  "Transforms should be 1D or 2D, got: %s" % transforms
              )
          # Make the transform(s) 2D in case the input is a single transform.
          transforms = tf.reshape(transforms, tf.constant([-1, 8]))
          num_transforms = tf.shape(transforms)[0]
          # Add a column of ones for the implicit last entry in the matrix.
          return tf.reshape(
              tf.concat(
                  [transforms, tf.ones([num_transforms, 1])], axis=1
              ),
              tf.constant([-1, 3, 3]),
          )
  
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 3 for calling a global function with example usage: flat_transforms_to_matrices(transforms, name) and returns: tf