code: def square_to_spherical_coordinates(
      point_2d: TensorLike,
      name: str = "math_square_to_spherical_coordinates",
  ) -> TensorLike:
      """Maps points from a unit square to a unit sphere.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        point_2d: A tensor of shape `[A1, ..., An, 2]` with values in [0,1].
        name: A name for this op. Defaults to
          "math_square_to_spherical_coordinates".
  
      Returns:
        A tensor of shape `[A1, ..., An, 2]` with [..., 0] having values in
        [0.0, pi] and [..., 1] with values in [0.0, 2pi].
  
      Raises:
        ValueError: if the shape of `point_2d`  is not supported.
        InvalidArgumentError: if at least an element of `point_2d` is outside of
        [0,1].
  
      """
      with tf.name_scope(name):
          point_2d = tf.convert_to_tensor(value=point_2d)
  
          shape.check_static(
              tensor=point_2d,
              tensor_name="point_2d",
              has_dim_equals=(-1, 2),
          )
          point_2d = asserts.assert_all_in_range(
              point_2d, 0.0, 1.0, open_bounds=False
          )
  
          x, y = tf.unstack(point_2d, axis=-1)
          theta = 2.0 * tf.acos(tf.sqrt(1.0 - x))
          phi = 2.0 * np.pi * y
          return tf.stack((tf.ones_like(theta), theta, phi), axis=-1)
  
file_path: graphics/tensorflow_graphics/math/math_helpers.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  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.type_alias import Float
  from tensorflow_graphics.util.type_alias import TensorLike
label_desc: Use image node_id 7 for calling a global function with example usage: square_to_spherical_coordinates(point_2d, name) and returns: tf