class_docstr: We use this object to :
      __init__:
          - Creates the step_model
          - Creates the train_model
  
      train():
          - Make the training part (feedforward and retropropagation of gradients)
  
      save/load():
          - Save load the model
class_docstr_tok: ["We","use","this","object","to",":","__init__",":","-","Creates","the","step_model","-","Creates","the","train_model","train","(",")",":","-","Make","the","training","part","(","feedforward","and","retropropagation","of","gradients",")","save\/load","(",")",":","-","Save","load","the","model"]
docstr: Train the model.
  Here we calculate advantage A(s,a) = R + yV(s') - V(s)
  
  Returns
  -------
  obj
      = R + yV(s')
docstr_tok: ["Train","the","model",".","Here","we","calculate","advantage","A","(","s",",","a",")","=","R","+","yV","(","s","'",")","-","V","(","s",")","Returns","--","--","--","-","obj","=","R","+","yV","(","s","'",")"]
code: def train(
      self,
      lr,
      cliprange,
      obs,
      returns,
      masks,
      actions,
      values,
      neglogpacs,
      states=None,
  ):
      """
      Train the model.
      Here we calculate advantage A(s,a) = R + yV(s') - V(s)
  
      Returns
      -------
      obj
          = R + yV(s')
      """
      advs = returns - values
  
      # Normalize the advantages
      advs = (advs - advs.mean()) / (advs.std() + 1e-8)
  
      td_map = {
          self.train_model.X: obs,
          self.A: actions,
          self.ADV: advs,
          self.R: returns,
          self.LR: lr,
          self.CLIPRANGE: cliprange,
          self.OLDNEGLOGPAC: neglogpacs,
          self.OLDVPRED: values,
      }
      if states is not None:
          td_map[self.train_model.S] = states
          td_map[self.train_model.M] = masks
  
      return self.sess.run(self.stats_list + [self._train_op], td_map)[
          :-1
      ]
  
imports: import tensorflow.compat.v1
  from .util import initialize, get_session
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj.train(lr, cliprange, obs, returns, masks, actions, values, neglogpacs, states) and returns: self