class_docstr: Maintains an exponential moving average.
  
  This uses the Adam debiasing procedure.
  See https://arxiv.org/pdf/1412.6980.pdf for details.
class_docstr_tok: ["Maintains","an","exponential","moving","average",".","This","uses","the","Adam","debiasing","procedure",".","See","https",":","\/\/arxiv.org\/pdf\/1412.6980.pdf","for","details","."]
docstr: Initializes an ExponentialMovingAverage module.
  
  Args:
    decay: The chosen decay. Must in ``[0, 1)``. Values close to 1 result in
      slow decay; values close to ``0`` result in fast decay.
    zero_debias: Whether to run with zero-debiasing.
    warmup_length: A positive integer, EMA has no effect until
      the internal counter has reached `warmup_length` at which point the
      initial value for the decaying average is initialized to the input value
      after `warmup_length` iterations.
    name: The name of the module.
docstr_tok: ["Initializes","an","ExponentialMovingAverage","module",".","Args",":","decay",":","The","chosen","decay",".","Must","in","``","[","0",",","1",")","``",".","Values","close","to","1","result","in","slow","decay",";","values","close","to","``","0","``","result","in","fast","decay",".","zero_debias",":","Whether","to","run","with","zero-debiasing",".","warmup_length",":","A","positive","integer",",","EMA","has","no","effect","until","the","internal","counter","has","reached","`","warmup_length","`","at","which","point","the","initial","value","for","the","decaying","average","is","initialized","to","the","input","value","after","`","warmup_length","`","iterations",".","name",":","The","name","of","the","module","."]
code: def __init__(
      self,
      decay,
      zero_debias: bool = True,
      warmup_length: int = 0,
      name: Optional[str] = None,
  ):
      """Initializes an ExponentialMovingAverage module.
  
      Args:
        decay: The chosen decay. Must in ``[0, 1)``. Values close to 1 result in
          slow decay; values close to ``0`` result in fast decay.
        zero_debias: Whether to run with zero-debiasing.
        warmup_length: A positive integer, EMA has no effect until
          the internal counter has reached `warmup_length` at which point the
          initial value for the decaying average is initialized to the input value
          after `warmup_length` iterations.
        name: The name of the module.
      """
      super().__init__(name=name)
      self.decay = decay
      self.warmup_length = warmup_length
      self.zero_debias = zero_debias
  
      if warmup_length < 0:
          raise ValueError(
              f"`warmup_length` is {warmup_length}, but should be non-negative."
          )
  
      if warmup_length and zero_debias:
          raise ValueError(
              "Zero debiasing does not make sense when warming up the value of the "
              "average to an initial value. Set zero_debias=False if setting "
              "warmup_length to a non-zero value."
          )
  
imports: import re
  from typing import Optional, Union
  import warnings
  from haiku._src import base
  from haiku._src import data_structures
  from haiku._src import initializers
  from haiku._src import module
  import jax
  import jax.numpy
label_desc: Use image node_id 1 to create a new ExponentialMovingAverage object from inherited base classes: hk with example: obj = ExponentialMovingAverage(decay, zero_debias, warmup_length, name)