class_docstr: Maintains an exponential moving average for a value.
  
  Note this module uses debiasing by default. If you don't want this please use
  an alternative implementation.
  
  This module keeps track of a hidden exponential moving average that is
  initialized as a vector of zeros which is then normalized to give the average.
  This gives us a moving average which isn't biased towards either zero or the
  initial value. Reference (https://arxiv.org/pdf/1412.6980.pdf)
  
  Initially:
  
      hidden_0 = 0
  
  Then iteratively:
  
      hidden_i = (hidden_{i-1} - value) * (1 - decay)
      average_i = hidden_i / (1 - decay^i)
  
  Attributes:
    average: Variable holding average. Note that this is None until the first
      value is passed.
docstr: Applies EMA to the value given.
code: def update(self, value: tf.Tensor):
      """Applies EMA to the value given."""
      self.initialize(value)
  
      self._counter.assign_add(1)
      value = tf.convert_to_tensor(value)
      counter = tf.cast(self._counter, value.dtype)
      self._hidden.assign_sub(
          (self._hidden - value) * (1 - self._decay)
      )
      self.average.assign(
          (self._hidden / (1.0 - tf.pow(self._decay, counter)))
      )
  
file_path: sonnet/sonnet/src/moving_averages.py
imports: from typing import Optional
  from sonnet.src import metrics
  from sonnet.src import once
  from sonnet.src import types
  import tensorflow
label_desc: Use image node_id 2 for calling the ExponentialMovingAverage obj's underlying member method code with example usage: obj.update(value) without return types