code: def vector_weights(
      vector1: type_alias.TensorLike,
      vector2: type_alias.TensorLike,
      percent: Union[type_alias.Float, type_alias.TensorLike],
      eps: Optional[type_alias.Float] = None,
      name: str = "vector_weights",
  ) -> Tuple[tf.Tensor, tf.Tensor]:
      """Spherical linear interpolation (slerp) between two unnormalized vectors.
  
      This function applies geometric slerp to unnormalized vectors by first
      normalizing them to return the interpolation weights. It reduces to lerp when
      input vectors are exactly anti-parallel.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        vector1: A tensor of shape `[A1, ... , An, M]`, which stores a normalized
          vector in its last dimension.
        vector2: A tensor of shape `[A1, ... , An, M]`, which stores a normalized
          vector in its last dimension.
        percent: A `float` or tensor with shape broadcastable to the shape of input
          vectors.
        eps: A small float for operation safety. If left None, its value is
          automatically selected using dtype of input vectors.
        name: A name for this op. Defaults to "vector_weights".
  
      Raises:
        ValueError: if the shape of `vector1`, `vector2`, or `percent` is not
          supported.
  
      Returns:
        Two tensors of shape `[A1, ... , An, 1]`, representing interpolation weights
        for each input vector.
      """
      with tf.name_scope(name):
          vector1 = tf.convert_to_tensor(value=vector1)
          vector2 = tf.convert_to_tensor(value=vector2)
          percent = tf.convert_to_tensor(
              value=percent, dtype=vector1.dtype
          )
  
          if percent.shape.ndims == 0:
              percent = tf.expand_dims(percent, axis=0)
          shape.compare_dimensions(
              tensors=(vector1, vector2),
              axes=-1,
              tensor_names=("vector1", "vector2"),
          )
          shape.compare_batch_dimensions(
              tensors=(vector1, vector2, percent),
              last_axes=-1,
              broadcast_compatible=True,
              tensor_names=("vector1", "vector2", "percent"),
          )
          normalized1 = tf.nn.l2_normalize(vector1, axis=-1)
          normalized2 = tf.nn.l2_normalize(vector2, axis=-1)
  
          dot_product = _safe_dot(normalized1, normalized2, eps)
  
          theta = tf.acos(dot_product)
          scale1 = safe_ops.safe_sinpx_div_sinx(
              theta, 1.0 - percent, eps
          )
          scale2 = safe_ops.safe_sinpx_div_sinx(theta, percent, eps)
          return scale1, scale2
  
file_path: graphics/tensorflow_graphics/math/interpolation/slerp.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import enum
  from typing import Optional, Tuple, Union
  import tensorflow
  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 5 for calling a global function with example usage: vector_weights(vector1, vector2, percent, eps, name) and returns: scale1,  scale2