class_docstr: The uniform distribution over unit vectors on `S^{n-1}`.
  
  The uniform distribution on the unit hypersphere `S^{n-1}` embedded in
  `n` dimensions (`R^n`).
  
  #### Mathematical details
  
  The probability density function (pdf) is,
  
  ```none
  pdf(x; n) = 1. / A(n)
  where,
  A(n) = 2 * pi^{n / 2} / Gamma(n / 2),
  Gamma being the Gamma function.
  ```
  
  where:
  * `n = dimension`; corresponds to `S^{n-1}` embedded in `R^n`.
  
  #### Examples
  
  A SphericalUniform distribution is defined in 3 dimensions.
  
  ```python
  tfd = tfp.distributions
  
  # Initialize a single 3-dimension SphericalUniform distribution.
  su = tfd.SphericalUniform(dimension=3, batch_shape=[])
  
  # Evaluate this on an observation in S^2 (in R^3), returning a scalar.
  su.prob([1., 0, 0])
  
  # Initialize a batch of 3 4-dimensional SphericalUniform distributions.
  su = tfd.SphericalUniform(dimension=4, batch_shape=[3])
  su.sample(5)  # Shape [5, 3, 4]
  ```
class_docstr_tok: ["The","uniform","distribution","over","unit","vectors","on","`","S^","{","n-1","}","`",".","The","uniform","distribution","on","the","unit","hypersphere","`","S^","{","n-1","}","`","embedded","in","`","n","`","dimensions","(","`","R^n","`",")",".","#","#","#","#","Mathematical","details","The","probability","density","function","(","pdf",")","is",",","``","`","none","pdf","(","x",";","n",")","=","1",".","\/","A","(","n",")","where",",","A","(","n",")","=","2","*","pi^","{","n","\/","2","}","\/","Gamma","(","n","\/","2",")",",","Gamma","being","the","Gamma","function",".","``","`","where",":","*","`","n","=","dimension","`",";","corresponds","to","`","S^","{","n-1","}","`","embedded","in","`","R^n","`",".","#","#","#","#","Examples","A","SphericalUniform","distribution","is","defined","in","3","dimensions",".","``","`","python","tfd","=","tfp.distributions","#","Initialize","a","single","3-dimension","SphericalUniform","distribution",".","su","=","tfd.SphericalUniform","(","dimension=3",",","batch_shape=","[","]",")","#","Evaluate","this","on","an","observation","in","S^2","(","in","R^3",")",",","returning","a","scalar",".","su.prob","(","[","1.",",","0",",","0","]",")","#","Initialize","a","batch","of","3","4-dimensional","SphericalUniform","distributions",".","su","=","tfd.SphericalUniform","(","dimension=4",",","batch_shape=","[","3","]",")","su.sample","(","5",")","#","Shape","[","5",",","3",",","4","]","``","`"]
docstr: Creates a new `SphericalUniform` instance.
  
  Args:
    dimension: Python `int`. The dimension of the embedded space where the
      sphere resides.
    batch_shape: Positive `int`-like vector-shaped `Tensor` representing
      the new shape of the batch dimensions.
      Default value: [].
    dtype: DType of the generated samples.
    validate_args: Python `bool`, default `False`. When `True` distribution
      parameters are checked for validity despite possibly degrading runtime
      performance. When `False` invalid inputs may silently render incorrect
      outputs.
    allow_nan_stats: Python `bool`, default `True`. When `True`,
      statistics (e.g., mean, mode, variance) use the value "`NaN`" to
      indicate the result is undefined. When `False`, an exception is raised
      if one or more of the statistic's batch members are undefined.
    name: Python `str` name prefixed to Ops created by this class.
  
  Raises:
    ValueError: For known-bad arguments, i.e. unsupported event dimension.
docstr_tok: ["Creates","a","new","`","SphericalUniform","`","instance",".","Args",":","dimension",":","Python","`","int","`",".","The","dimension","of","the","embedded","space","where","the","sphere","resides",".","batch_shape",":","Positive","`","int","`","-like","vector-shaped","`","Tensor","`","representing","the","new","shape","of","the","batch","dimensions",".","Default","value",":","[","]",".","dtype",":","DType","of","the","generated","samples",".","validate_args",":","Python","`","bool","`",",","default","`","False","`",".","When","`","True","`","distribution","parameters","are","checked","for","validity","despite","possibly","degrading","runtime","performance",".","When","`","False","`","invalid","inputs","may","silently","render","incorrect","outputs",".","allow_nan_stats",":","Python","`","bool","`",",","default","`","True","`",".","When","`","True","`",",","statistics","(","e.g.",",","mean",",","mode",",","variance",")","use","the","value","``","`","NaN","`","``","to","indicate","the","result","is","undefined",".","When","`","False","`",",","an","exception","is","raised","if","one","or","more","of","the","statistic","'s","batch","members","are","undefined",".","name",":","Python","`","str","`","name","prefixed","to","Ops","created","by","this","class",".","Raises",":","ValueError",":","For","known-bad","arguments",",","i.e",".","unsupported","event","dimension","."]
code: def __init__(
      self,
      dimension,
      batch_shape=tuple(),
      dtype=tf.float32,
      validate_args=False,
      allow_nan_stats=True,
      name="SphericalUniform",
  ):
      """Creates a new `SphericalUniform` instance.
  
      Args:
        dimension: Python `int`. The dimension of the embedded space where the
          sphere resides.
        batch_shape: Positive `int`-like vector-shaped `Tensor` representing
          the new shape of the batch dimensions.
          Default value: [].
        dtype: DType of the generated samples.
        validate_args: Python `bool`, default `False`. When `True` distribution
          parameters are checked for validity despite possibly degrading runtime
          performance. When `False` invalid inputs may silently render incorrect
          outputs.
        allow_nan_stats: Python `bool`, default `True`. When `True`,
          statistics (e.g., mean, mode, variance) use the value "`NaN`" to
          indicate the result is undefined. When `False`, an exception is raised
          if one or more of the statistic's batch members are undefined.
        name: Python `str` name prefixed to Ops created by this class.
  
      Raises:
        ValueError: For known-bad arguments, i.e. unsupported event dimension.
      """
      parameters = dict(locals())
      with tf.name_scope(name) as name:
          if dimension < 0:
              raise ValueError(
                  "Cannot sample negative-dimension unit vectors."
              )
          shape_dtype = dtype_util.common_dtype(
              [batch_shape], dtype_hint=tf.int32
          )
          self._dimension = dimension
          self._batch_shape_parameter = (
              tensor_util.convert_nonref_to_tensor(
                  batch_shape,
                  dtype=shape_dtype,
                  name="batch_shape",
                  as_shape_tensor=True,
              )
          )
          self._batch_shape_static = (
              tensorshape_util.constant_value_as_shape(
                  self._batch_shape_parameter
              )
          )
  
          super(SphericalUniform, self).__init__(
              dtype=dtype,
              validate_args=validate_args,
              allow_nan_stats=allow_nan_stats,
              reparameterization_type=reparameterization.FULLY_REPARAMETERIZED,
              parameters=parameters,
              name=name,
          )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import softmax_centered
  from tensorflow_probability.python.bijectors import square
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.random import random_ops
label_desc: Use image node_id 1 to create a new SphericalUniform object from inherited base classes: distribution with example: obj = SphericalUniform(dimension, batch_shape, dtype, validate_args, allow_nan_stats, name)