original_docstring:  Add a sum of future discounted rewards field to rollout dict.
docstring: Add a sum of future discounted rewards field to rollout dict.
docstring_tokens: Add a sum of future discounted rewards field to rollout dict .
code: def _compute_values(self, rollout):
          """ Add a sum of future discounted rewards field to rollout dict."""
          rs = rollout["rs"]
          values = deque()
          last_value = 0.0
          for ii in range(len(rs)):
              # ii is a reverse iteration index, i.e. we're counting backward.
              r = rs[len(rs) - ii - 1]
              values.appendleft(self._discount_factor * last_value + r)
              last_value = values[0]
  
          # Convert to list.
          values = list(values)
          rollout["values"] = values
code_tokens: def _compute_values ( self , rollout ) : rs = rollout [ "rs" ] values = deque ( ) last_value = 0.0 for ii in range ( len ( rs ) ) : r = rs [ len ( rs ) - ii - 1 ] values . appendleft ( self . _discount_factor * last_value + r ) last_value = values [ 0 ] values = list ( values ) rollout [ "values" ] = values
short_docstring: Add a sum of future discounted rewards field to rollout dict.
short_docstring_tokens: Add a sum of future discounted rewards field to rollout dict .
comment: """ Add a sum of future discounted rewards field to rollout dict."""$SEP$# ii is a reverse iteration index, i.e. we're counting backward.$SEP$# Convert to list.