docstr: A parallel MPI implementation of the Adam optimizer for TensorFlow
  https://arxiv.org/abs/1412.6980
  
  :param var_list: ([TensorFlow Tensor]) the variables
  :param beta1: (float) Adam beta1 parameter
  :param beta2: (float) Adam beta1 parameter
  :param epsilon: (float) to help with preventing arithmetic issues
  :param scale_grad_by_procs: (bool) if the scaling should be done by processes
  :param comm: (MPI Communicators) if None, mpi4py.MPI.COMM_WORLD
  :param sess: (TensorFlow Session) if None, tf.get_default_session()
docstr_tok: ["A","parallel","MPI","implementation","of","the","Adam","optimizer","for","TensorFlow","https",":","\/\/arxiv.org\/abs\/1412.6980",":","param","var_list",":","(","[","TensorFlow","Tensor","]",")","the","variables",":","param","beta1",":","(","float",")","Adam","beta1","parameter",":","param","beta2",":","(","float",")","Adam","beta1","parameter",":","param","epsilon",":","(","float",")","to","help","with","preventing","arithmetic","issues",":","param","scale_grad_by_procs",":","(","bool",")","if","the","scaling","should","be","done","by","processes",":","param","comm",":","(","MPI","Communicators",")","if","None",",","mpi4py.MPI.COMM_WORLD",":","param","sess",":","(","TensorFlow","Session",")","if","None",",","tf.get_default_session","(",")"]
code: def __init__(
      self,
      var_list,
      *,
      beta1=0.9,
      beta2=0.999,
      epsilon=1e-08,
      scale_grad_by_procs=True,
      comm=None,
      sess=None,
  ):
      """
      A parallel MPI implementation of the Adam optimizer for TensorFlow
      https://arxiv.org/abs/1412.6980
  
      :param var_list: ([TensorFlow Tensor]) the variables
      :param beta1: (float) Adam beta1 parameter
      :param beta2: (float) Adam beta1 parameter
      :param epsilon: (float) to help with preventing arithmetic issues
      :param scale_grad_by_procs: (bool) if the scaling should be done by processes
      :param comm: (MPI Communicators) if None, mpi4py.MPI.COMM_WORLD
      :param sess: (TensorFlow Session) if None, tf.get_default_session()
      """
      self.var_list = var_list
      self.beta1 = beta1
      self.beta2 = beta2
      self.epsilon = epsilon
      self.scale_grad_by_procs = scale_grad_by_procs
      size = sum(tf_utils.numel(v) for v in var_list)
      # Exponential moving average of gradient values
      # "first moment estimate" m in the paper
      self.exp_avg = np.zeros(size, "float32")
      # Exponential moving average of squared gradient values
      # "second raw moment estimate" v in the paper
      self.exp_avg_sq = np.zeros(size, "float32")
      self.step = 0
      self.setfromflat = tf_utils.SetFromFlat(var_list, sess=sess)
      self.getflat = tf_utils.GetFlat(var_list, sess=sess)
      self.comm = mpi4py.MPI.COMM_WORLD if comm is None else comm
  
file_path: stable-baselines/stable_baselines/common/mpi_adam.py
imports: import tensorflow
  import numpy
  import mpi4py
  import stable_baselines.common.tf_util
label_desc: Use image node_id 1 to create a new MpiAdam object from inherited base classes: object with example: obj = MpiAdam(var_list)