code: def default_loc_scale_fn(
      is_singular=False,
      loc_initializer=tf_keras.initializers.RandomNormal(stddev=0.1),
      untransformed_scale_initializer=tf_keras.initializers.RandomNormal(
          mean=-3.0, stddev=0.1
      ),
      loc_regularizer=None,
      untransformed_scale_regularizer=None,
      loc_constraint=None,
      untransformed_scale_constraint=None,
  ):
      """Makes closure which creates `loc`, `scale` params from `tf.get_variable`.
  
      This function produces a closure which produces `loc`, `scale` using
      `tf.get_variable`. The closure accepts the following arguments:
  
        dtype: Type of parameter's event.
        shape: Python `list`-like representing the parameter's event shape.
        name: Python `str` name prepended to any created (or existing)
          `tf.Variable`s.
        trainable: Python `bool` indicating all created `tf.Variable`s should be
          added to the graph collection `GraphKeys.TRAINABLE_VARIABLES`.
        add_variable_fn: `tf.get_variable`-like `callable` used to create (or
          access existing) `tf.Variable`s.
  
      Args:
        is_singular: Python `bool` indicating if `scale is None`. Default: `False`.
        loc_initializer: Initializer function for the `loc` parameters.
          The default is `tf.random_normal_initializer(mean=0., stddev=0.1)`.
        untransformed_scale_initializer: Initializer function for the `scale`
          parameters. Default value: `tf.random_normal_initializer(mean=-3.,
          stddev=0.1)`. This implies the softplus transformed result is initialized
          near `0`. It allows a `Normal` distribution with `scale` parameter set to
          this value to approximately act like a point mass.
        loc_regularizer: Regularizer function for the `loc` parameters.
          The default (`None`) is to use the `tf.get_variable` default.
        untransformed_scale_regularizer: Regularizer function for the `scale`
          parameters. The default (`None`) is to use the `tf.get_variable` default.
        loc_constraint: An optional projection function to be applied to the
          loc after being updated by an `Optimizer`. The function must take as input
          the unprojected variable and must return the projected variable (which
          must have the same shape). Constraints are not safe to use when doing
          asynchronous distributed training.
          The default (`None`) is to use the `tf.get_variable` default.
        untransformed_scale_constraint: An optional projection function to be
          applied to the `scale` parameters after being updated by an `Optimizer`
          (e.g. used to implement norm constraints or value constraints). The
          function must take as input the unprojected variable and must return the
          projected variable (which must have the same shape). Constraints are not
          safe to use when doing asynchronous distributed training. The default
          (`None`) is to use the `tf.get_variable` default.
  
      Returns:
        default_loc_scale_fn: Python `callable` which instantiates `loc`, `scale`
        parameters from args: `dtype, shape, name, trainable, add_variable_fn`.
      """
  
      def _fn(dtype, shape, name, trainable, add_variable_fn):
          """Creates `loc`, `scale` parameters."""
          loc = add_variable_fn(
              name=name + "_loc",
              shape=shape,
              initializer=loc_initializer,
              regularizer=loc_regularizer,
              constraint=loc_constraint,
              dtype=dtype,
              trainable=trainable,
          )
          if is_singular:
              return loc, None
          untransformed_scale = add_variable_fn(
              name=name + "_untransformed_scale",
              shape=shape,
              initializer=untransformed_scale_initializer,
              regularizer=untransformed_scale_regularizer,
              constraint=untransformed_scale_constraint,
              dtype=dtype,
              trainable=trainable,
          )
          scale = tfp_util.DeferredTensor(
              untransformed_scale,
              lambda x: (
                  np.finfo(dtype.as_numpy_dtype).eps + tf.nn.softplus(x)
              ),
          )
          return loc, scale
  
      return _fn
  
file_path: probability/tensorflow_probability/python/layers/util.py
imports: import binascii
  import codecs
  import marshal
  import os
  import types
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python import util
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import tf_keras
label_desc: Use image node_id 1 for calling a global function with example usage: default_loc_scale_fn(is_singular, loc_initializer, untransformed_scale_initializer, loc_regularizer, untransformed_scale_regularizer, loc_constraint, untransformed_scale_constraint) and returns: _fn, loc,  scale, loc,  None