class_docstr: Normalization layer based on the exponential moving average of mean and variance over the
  temporal sequence of inputs
  (specification key: `exponential_normalization`).
  
  Args:
      decay (parameter, 0.0 <= float <= 1.0): Decay rate
          (<span style="color:#C00000"><b>required</b></span>).
      axes (iter[int >= 0]): Normalization axes, excluding batch axis
          (<span style="color:#00C000"><b>default</b></span>: all but last input axes).
      only_mean (bool): Whether to normalize only with respect to mean, not variance
          (<span style="color:#00C000"><b>default</b></span>: false).
      min_variance (float > 0.0): Clip variance lower than minimum
          (<span style="color:#00C000"><b>default</b></span>: 1e-4).
      name (string): Layer name
          (<span style="color:#00C000"><b>default</b></span>: internally chosen).
      input_spec (specification): <span style="color:#00C000"><b>internal use</b></span>.
class_docstr_tok: ["Normalization","layer","based","on","the","exponential","moving","average","of","mean","and","variance","over","the","temporal","sequence","of","inputs","(","specification","key",":","`","exponential_normalization","`",")",".","Args",":","decay","(","parameter",",","0.0","<","=","float","<","=","1.0",")",":","Decay","rate","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","axes","(","iter","[","int",">","=","0","]",")",":","Normalization","axes",",","excluding","batch","axis","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","all","but","last","input","axes",")",".","only_mean","(","bool",")",":","Whether","to","normalize","only","with","respect","to","mean",",","not","variance","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","min_variance","(","float",">","0.0",")",":","Clip","variance","lower","than","minimum","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1e-4",")",".","name","(","string",")",":","Layer","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","internally","chosen",")",".","input_spec","(","specification",")",":","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def apply(self, *, x, independent):
      if independent or self.decay.is_constant(value=1.0):
          mean = self.moving_mean
          if not self.only_mean:
              variance = self.moving_variance
  
      else:
          zero = tf_util.constant(value=0, dtype="int")
          one_float = tf_util.constant(value=1.0, dtype="float")
          axes = (0,) + tuple(1 + axis for axis in self.axes)
  
          batch_size = tf_util.cast(x=tf.shape(input=x)[0], dtype="int")
          is_zero_batch = tf.math.equal(x=batch_size, y=zero)
  
          if self.only_mean:
  
              def true_fn():
                  return self.moving_mean
  
              def false_fn():
                  return tf.math.reduce_mean(
                      input_tensor=x, axis=axes, keepdims=True
                  )
  
              mean = tf.cond(
                  pred=is_zero_batch, true_fn=true_fn, false_fn=false_fn
              )
  
          else:
  
              def true_fn():
                  return self.moving_mean, self.moving_variance
  
              def false_fn():
                  _mean = tf.math.reduce_mean(
                      input_tensor=x, axis=axes, keepdims=True
                  )
                  deviation = tf.math.squared_difference(x=x, y=_mean)
                  _variance = tf.reduce_mean(
                      input_tensor=deviation, axis=axes, keepdims=True
                  )
                  return _mean, _variance
  
              mean, variance = tf.cond(
                  pred=is_zero_batch, true_fn=true_fn, false_fn=false_fn
              )
  
          if not self.decay.is_constant(value=0.0):
              decay = self.decay.value()
              batch_size = tf_util.cast(x=batch_size, dtype="float")
              # Pow numerically stable since 0.0 <= decay <= 1.0
              decay = tf.math.pow(x=decay, y=batch_size)
  
              mean = (
                  decay * self.moving_mean + (one_float - decay) * mean
              )
              if not self.only_mean:
                  variance = (
                      decay * self.moving_variance
                      + (one_float - decay) * variance
                  )
  
          mean = self.moving_mean.assign(value=mean)
          if not self.only_mean:
              variance = self.moving_variance.assign(value=variance)
  
      if not self.only_mean:
          min_variance = tf_util.constant(
              value=self.min_variance, dtype="float"
          )
          reciprocal_stddev = tf.math.rsqrt(
              x=tf.maximum(x=variance, y=min_variance)
          )
  
      x = x - tf.stop_gradient(input=mean)
      if not self.only_mean:
          x = x * tf.stop_gradient(input=reciprocal_stddev)
  
      return x
  
imports: import numpy
  import tensorflow
  from tensorforce import TensorforceError
  from tensorforce.core import parameter_modules, TensorSpec, tf_function, tf_util
  from tensorforce.core.layers import Layer, StatefulLayer
label_desc: Use image node_id 4 for calling the ExponentialNormalization obj's underlying member method code with example usage: obj.apply() and returns: x, self, tf, self,  self, _mean,  _variance