class_docstr: Recorder wrapper (specification key: `recorder`).
  
  Args:
      fn_act (callable[states -> actions]): Act-function mapping states to actions which is
          supposed to be recorded.
class_docstr_tok: ["Recorder","wrapper","(","specification","key",":","`","recorder","`",")",".","Args",":","fn_act","(","callable","[","states","-",">","actions","]",")",":","Act-function","mapping","states","to","actions","which","is","supposed","to","be","recorded","."]
code: def initialize(self):
      # Check whether already initialized
      if self.is_initialized:
          raise TensorforceError(
              message="Agent is already initialized, possibly as part of Agent.create()."
          )
      self.is_initialized = True
  
      # Act-observe timestep check
      self.timestep_counter = np.zeros(
          shape=(self.parallel_interactions,),
          dtype=util.np_dtype(dtype="int"),
      )
      self.timestep_completed = np.ones(
          shape=(self.parallel_interactions,),
          dtype=util.np_dtype(dtype="bool"),
      )
  
      # Recorder buffers if required
      if self.recorder is not None:
          self.num_episodes = 0
  
          self.buffers = ListDict()
          self.buffers["terminal"] = [
              list() for _ in range(self.parallel_interactions)
          ]
          self.buffers["reward"] = [
              list() for _ in range(self.parallel_interactions)
          ]
  
          def function(spec):
              return [list() for _ in range(self.parallel_interactions)]
  
          self.buffers["states"] = self.states_spec.fmap(
              function=function, cls=ListDict
          )
          self.buffers["actions"] = self.actions_spec.fmap(
              function=function, cls=ListDict
          )
  
          function = lambda x: list()
  
          self.recorded = ListDict()
          self.recorded["states"] = self.states_spec.fmap(
              function=function, cls=ListDict
          )
          self.recorded["actions"] = self.actions_spec.fmap(
              function=function, cls=ListDict
          )
          self.recorded["terminal"] = list()
          self.recorded["reward"] = list()
  
file_path: tensorforce/tensorforce/agents/recorder.py
imports: import os
  from collections import OrderedDict
  import numpy
  from tensorforce import TensorforceError, util
  from tensorforce.core import ArrayDict, ListDict, TensorSpec, TensorsSpec
label_desc: Use image node_id 2 for calling the Recorder obj's underlying member method code with example usage: obj.initialize() and returns: unknown