code: def matrix_from_intrinsics(
      focal: type_alias.TensorLike,
      principal_point: type_alias.TensorLike,
      skew: type_alias.TensorLike = (0.0,),
      name: str = "perspective_matrix_from_intrinsics",
  ) -> tf.Tensor:
      r"""Builds calibration matrix from intrinsic parameters.
  
    Builds the camera calibration matrix as
  
    $$
    \mathbf{C} =
    \begin{bmatrix}
    f_x & sc & c_x \\
    0  & f_y & c_y \\
    0  & 0  & 1 \\
    \end{bmatrix}
    $$
  
    from the focal length \\((f_x, f_y)\\) and the principal point
    \\((c_x, c_y)\\).
  
    Note:
      In the following, A1 to An are optional batch dimensions.
  
    Args:
      focal: A tensor of shape `[A1, ..., An, 2]`, where the last dimension
        represents a camera focal length.
      principal_point: A tensor of shape `[A1, ..., An, 2]`, where the last
        dimension represents a camera principal point.
      skew: A tensor of shape `[A1, ..., An, 1]`, where the last dimension
        represents a skew coefficient.
      name: A name for this op that defaults to
        "perspective_matrix_from_intrinsics".
  
    Returns:
      A tensor of shape `[A1, ..., An, 3, 3]`, where the last two dimensions
      represent a camera calibration matrix.
  
    Raises:
      ValueError: If the shape of `focal`, or `principal_point` is not
      supported.
    """
      with tf.name_scope(name):
          focal = tf.convert_to_tensor(value=focal)
          principal_point = tf.convert_to_tensor(value=principal_point)
          skew = tf.convert_to_tensor(value=skew)
          common_batch_shape = shape.get_broadcasted_shape(
              focal.shape[:-1], skew.shape[:-1]
          )
  
          def dim_value(dim):
              return (
                  1 if dim is None else tf.compat.dimension_value(dim)
              )
  
          common_batch_shape = [
              dim_value(dim) for dim in common_batch_shape
          ]
          skew = tf.broadcast_to(skew, common_batch_shape + [1])
          shape.check_static(
              tensor=focal, tensor_name="focal", has_dim_equals=(-1, 2)
          )
          shape.check_static(
              tensor=principal_point,
              tensor_name="principal_point",
              has_dim_equals=(-1, 2),
          )
          shape.check_static(
              tensor=skew,
              tensor_name="skew",
              has_dim_equals=(-1, 1),
          )
          shape.compare_batch_dimensions(
              tensors=(focal, principal_point, skew),
              tensor_names=("focal", "principal_point", "skew"),
              last_axes=-2,
              broadcast_compatible=False,
          )
  
          fx, fy = tf.unstack(focal, axis=-1)
          cx, cy = tf.unstack(principal_point, axis=-1)
          zero = tf.zeros_like(fx)
          one = tf.ones_like(fx)
          skew = tf.reshape(skew, tf.shape(fx))
          matrix = tf.stack(
              (fx, skew, cx, zero, fy, cy, zero, zero, one), axis=-1
          )  # pyformat: disable
          matrix_shape = tf.shape(input=matrix)
          output_shape = tf.concat((matrix_shape[:-1], (3, 3)), axis=-1)
          return tf.reshape(matrix, shape=output_shape)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from typing import Tuple
  import tensorflow
  from tensorflow_graphics.geometry.representation import grid
  from tensorflow_graphics.util import asserts
  from tensorflow_graphics.util import export_api
  from tensorflow_graphics.util import safe_ops
  from tensorflow_graphics.util import shape
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 4 for calling a global function with example usage: matrix_from_intrinsics(focal, principal_point, skew, name) and returns: tf, unknown