class_docstr: Base class for memories organized as a queue / circular buffer.
  
  Args:
      capacity (int > 0): Memory capacity
          (<span style="color:#00C000"><b>default</b></span>: minimum capacity).
      device (string): Device name
          (<span style="color:#00C000"><b>default</b></span>: CPU:0).
      name (string): <span style="color:#0000C0"><b>internal use</b></span>.
      values_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      min_capacity (int >= 0): <span style="color:#0000C0"><b>internal use</b></span>.
class_docstr_tok: ["Base","class","for","memories","organized","as","a","queue","\/","circular","buffer",".","Args",":","capacity","(","int",">","0",")",":","Memory","capacity","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","minimum","capacity",")",".","device","(","string",")",":","Device","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","CPU:0",")",".","name","(","string",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","values_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","min_capacity","(","int",">","=","0",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def initialize(self):
      super().initialize()
  
      # Value buffers
      def function(name, spec):
          spec = TensorSpec(
              type=spec.type, shape=((self.capacity,) + spec.shape)
          )
          if name == "terminal":
              initializer = np.zeros(
                  shape=(self.capacity,), dtype=spec.np_type()
              )
              initializer[-1] = 1
          else:
              initializer = "zeros"
          return self.variable(
              name=(name + "-buffer"),
              spec=spec,
              initializer=initializer,
              is_trainable=False,
              is_saved=True,
          )
  
      self.buffers = self.values_spec.fmap(
          function=function, cls=VariableDict, with_names=True
      )
  
      # Buffer index (modulo capacity, next index to write to)
      self.buffer_index = self.variable(
          name="buffer-index",
          spec=TensorSpec(type="int"),
          initializer="zeros",
          is_trainable=False,
          is_saved=True,
      )
  
      # Terminal indices
      # (oldest episode terminals first, initially the only terminal is last index)
      initializer = np.zeros(
          shape=(self.capacity + 1,), dtype=util.np_dtype(dtype="int")
      )
      initializer[0] = self.capacity - 1
      self.terminal_indices = self.variable(
          name="terminal-indices",
          spec=TensorSpec(type="int", shape=(self.capacity + 1,)),
          initializer=initializer,
          is_trainable=False,
          is_saved=True,
      )
  
      # Episode count
      self.episode_count = self.variable(
          name="episode-count",
          spec=TensorSpec(type="int"),
          initializer="zeros",
          is_trainable=False,
          is_saved=True,
      )
  
file_path: tensorforce/tensorforce/core/memories/queue.py
imports: import numpy
  import tensorflow
  from tensorforce import TensorforceError, util
  from tensorforce.core import TensorDict, TensorSpec, tf_function, tf_util, VariableDict
  from tensorforce.core.memories import Memory
label_desc: Use image node_id 2 for calling the Queue obj's underlying member method code with example usage: obj.initialize() and returns: self