class_docstr: Bijector to implement Activation Normalization (ActNorm).
class_docstr_tok: ["Bijector","to","implement","Activation","Normalization","(","ActNorm",")","."]
docstr: Initialize if not already initialized.
code: def _maybe_init(self, inputs, inverse):
      """Initialize if not already initialized."""
  
      def _init():
          """Build the data-dependent initialization."""
          axis = prefer_static.range(prefer_static.rank(inputs) - 1)
          m = tf.math.reduce_mean(inputs, axis=axis)
          s = (
              tf.math.reduce_std(inputs, axis=axis)
              + 10.0
              * np.finfo(dtype_util.as_numpy_dtype(inputs.dtype)).eps
          )
          if inverse:
              s = 1 / s
              m = -m
          else:
              m = m / s
          with tf.control_dependencies(
              [self._m.assign(m), self._s.assign(s)]
          ):
              return self._initialized.assign(True)
  
      return tf.cond(self._initialized, tf.no_op, _init)
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import blockwise
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import composition
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import real_nvp
  from tensorflow_probability.python.bijectors import reshape
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import scale_matvec_lu
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.bijectors import transpose
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.util.deferred_tensor import TransformedVariable
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 6 for calling the ActivationNormalization obj's underlying member method code with example usage: obj._maybe_init(inputs, inverse) and returns: tf, self