code: def flat_transforms_to_matrices(transforms):
      """Converts `tf.contrib.image` 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)`.
  
      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 ops.name_scope("flat_transforms_to_matrices"):
          transforms = ops.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 = array_ops.reshape(
              transforms, constant_op.constant([-1, 8])
          )
          num_transforms = array_ops.shape(transforms)[0]
          # Add a column of ones for the implicit last entry in the matrix.
          return array_ops.reshape(
              array_ops.concat(
                  [transforms, array_ops.ones([num_transforms, 1])],
                  axis=1,
              ),
              constant_op.constant([-1, 3, 3]),
          )
  
file_path: tensorflow/tensorflow/python/ops/image_ops.py
imports: from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_image_ops
  from tensorflow.python.ops import linalg_ops
  from tensorflow.python.ops.gen_image_ops import *
  from tensorflow.python.ops.image_ops_impl import *
  from tensorflow.python.ops.image_ops_impl import _Check3DImage
  from tensorflow.python.ops.image_ops_impl import _ImageDimensions
label_desc: Use image node_id 1 for calling a global function with example usage: flat_transforms_to_matrices(transforms) and returns: array_ops