code: def _tril_spherical_uniform(dimension, batch_shape, dtype, seed):
      """Returns a `Tensor` of samples of lower triangular matrices.
  
      Each row of the lower triangular part follows a spherical uniform
      distribution.
  
      Args:
        dimension: Scalar `int` `Tensor`, representing the dimensionality of the
          output matrices.
        batch_shape: Vector-shaped, `int` `Tensor` representing batch shape of
          output. The output will have shape `batch_shape + [dimension, dimension]`.
        dtype: TF `dtype` representing `dtype` of output.
        seed: PRNG seed; see `tfp.random.sanitize_seed` for details.
  
      Returns:
        tril_spherical_uniform: `Tensor` with specified `batch_shape` and `dtype`
          consisting of real values drawn row-wise from a spherical uniform
          distribution.
      """
      # Essentially, we will draw lower triangular samples where each lower
      # triangular entry follows a normal distribution, then apply `x / norm(x)`
      # for each row of the samples.
      # To avoid possible NaNs, we will use spherical_uniform directly for
      # the first two rows.
      assert dimension > 0, "`dimension` needs to be positive."
      num_seeds = min(dimension, 3)
      seeds = list(
          samplers.split_seed(seed, n=num_seeds, salt="sample_lkj")
      )
      rows = []
      paddings_prepend = [[0, 0]] * len(batch_shape)
      for n in range(1, min(dimension, 2) + 1):
          rows.append(
              tf.pad(
                  random_ops.spherical_uniform(
                      shape=batch_shape,
                      dimension=n,
                      dtype=dtype,
                      seed=seeds.pop(),
                  ),
                  paddings_prepend + [[0, dimension - n]],
                  constant_values=0.0,
              )
          )
      samples = tf.stack(rows, axis=-2)
      if dimension > 2:
          normal_shape = ps.concat(
              [batch_shape, [dimension * (dimension + 1) // 2 - 3]],
              axis=0,
          )
          normal_samples = samplers.normal(
              shape=normal_shape, dtype=dtype, seed=seeds.pop()
          )
          # We fill the first two rows of the triangular matrix with ones.
          # Note that fill_triangular fills elements in a clockwise spiral.
          normal_samples = tf.concat(
              [
                  normal_samples[..., :dimension],
                  tf.ones(
                      ps.concat([batch_shape, [1]], axis=0), dtype=dtype
                  ),
                  normal_samples[..., dimension : (2 * dimension - 1)],
                  tf.ones(
                      ps.concat([batch_shape, [2]], axis=0), dtype=dtype
                  ),
                  normal_samples[..., (2 * dimension - 1) :],
              ],
              axis=-1,
          )
          normal_samples = linalg.fill_triangular(
              normal_samples, upper=False
          )[..., 2:, :]
          remaining_rows = normal_samples / tf.norm(
              normal_samples, ord=2, axis=-1, keepdims=True
          )
          samples = tf.concat([samples, remaining_rows], axis=-2)
      return samples
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import cholesky_outer_product
  from tensorflow_probability.python.bijectors import correlation_cholesky
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.distributions import beta
  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 parameter_properties
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math import linalg
  from tensorflow_probability.python.math import special
  from tensorflow_probability.python.math.numeric import clip_by_value_preserve_gradient
  from tensorflow_probability.python.random import random_ops
  from tensorflow.python.ops import control_flow_util
label_desc: Use image node_id 1 for calling a global function with example usage: _tril_spherical_uniform(dimension, batch_shape, dtype, seed) and returns: samples