code: def _build_quaternion_from_sines_and_cosines(
      sin_half_angles: type_alias.TensorLike,
      cos_half_angles: type_alias.TensorLike,
  ) -> tf.Tensor:
      """Builds a quaternion from sines and cosines of half Euler angles.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        sin_half_angles: A tensor of shape `[A1, ..., An, 3]`, where the last
          dimension represents the sine of half Euler angles.
        cos_half_angles: A tensor of shape `[A1, ..., An, 3]`, where the last
          dimension represents the cosine of half Euler angles.
  
      Returns:
        A tensor of shape `[A1, ..., An, 4]`, where the last dimension represents
        a quaternion.
      """
      c1, c2, c3 = tf.unstack(cos_half_angles, axis=-1)
      s1, s2, s3 = tf.unstack(sin_half_angles, axis=-1)
      w = c1 * c2 * c3 + s1 * s2 * s3
      x = -c1 * s2 * s3 + s1 * c2 * c3
      y = c1 * s2 * c3 + s1 * c2 * s3
      z = -s1 * s2 * c3 + c1 * c2 * s3
      return tf.stack((x, y, z, w), axis=-1)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import List
  from six.moves import range
  import tensorflow
  from tensorflow_graphics.geometry.transformation import rotation_matrix_3d
  from tensorflow_graphics.math import vector
  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 1 for calling a global function with example usage: _build_quaternion_from_sines_and_cosines(sin_half_angles, cos_half_angles) and returns: tf