code: def _build_matrix_from_sines_and_cosines(
      sin_angles: type_alias.TensorLike,
      cos_angles: type_alias.TensorLike,
  ) -> tf.Tensor:
      """Builds a rotation matrix from sines and cosines of Euler angles.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        sin_angles: A tensor of shape `[A1, ..., An, 3]`, where the last dimension
          represents the sine of the Euler angles.
        cos_angles: A tensor of shape `[A1, ..., An, 3]`, where the last dimension
          represents the cosine of the Euler angles.
  
      Returns:
        A tensor of shape `[A1, ..., An, 3, 3]`, where the last two dimensions
        represent a 3d rotation matrix.
      """
      sin_angles.shape.assert_is_compatible_with(cos_angles.shape)
  
      sx, sy, sz = tf.unstack(sin_angles, axis=-1)
      cx, cy, cz = tf.unstack(cos_angles, axis=-1)
      m00 = cy * cz
      m01 = (sx * sy * cz) - (cx * sz)
      m02 = (cx * sy * cz) + (sx * sz)
      m10 = cy * sz
      m11 = (sx * sy * sz) + (cx * cz)
      m12 = (cx * sy * sz) - (sx * cz)
      m20 = -sy
      m21 = sx * cy
      m22 = cx * cy
      matrix = tf.stack(
          (m00, m01, m02, m10, m11, m12, m20, m21, m22), axis=-1
      )  # pyformat: disable
      output_shape = tf.concat(
          (tf.shape(input=sin_angles)[:-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
  from absl import flags
  from six.moves import range
  import tensorflow
  from tensorflow_graphics.geometry.transformation import rotation_matrix_common
  from tensorflow_graphics.util import asserts
  from tensorflow_graphics.util import export_api
  from tensorflow_graphics.util import shape
  from tensorflow_graphics.util import tfg_flags
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 1 for calling a global function with example usage: _build_matrix_from_sines_and_cosines(sin_angles, cos_angles) and returns: tf