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 __init__(
      self,
      fn_act,
      states,
      actions,
      max_episode_timesteps=None,
      parallel_interactions=1,
      recorder=None,
  ):
      self.is_initialized = False
  
      # fn_act=None means Agent
      if fn_act is None:
          from tensorforce import Agent
  
          assert isinstance(self, Agent)
          self._is_agent = True
      else:
          self._is_agent = False
          self.fn_act = fn_act
  
      # States/actions, plus single state/action flag
      if "type" in states or "shape" in states:
          self.states_spec = TensorsSpec(singleton=states)
      else:
          self.states_spec = TensorsSpec(states)
      if "type" in actions or "shape" in actions:
          self.actions_spec = TensorsSpec(singleton=actions)
      else:
          self.actions_spec = TensorsSpec(actions)
  
      # Max episode timesteps
      if max_episode_timesteps is None:
          self.max_episode_timesteps = None
      else:
          self.max_episode_timesteps = int(max_episode_timesteps)
  
      # Parallel interactions
      if isinstance(parallel_interactions, int):
          if parallel_interactions <= 0:
              raise TensorforceError.value(
                  name="Agent",
                  argument="parallel_interactions",
                  value=parallel_interactions,
                  hint="<= 0",
              )
          self.parallel_interactions = parallel_interactions
      else:
          raise TensorforceError.type(
              name="Agent",
              argument="parallel_interactions",
              dtype=type(parallel_interactions),
          )
  
      # Other specifications
      self.internals_spec = TensorsSpec()
      self.terminal_spec = TensorSpec(type=int, shape=(), num_values=3)
      self.reward_spec = TensorSpec(type=float, shape=())
      self.parallel_spec = TensorSpec(
          type=int, shape=(), num_values=self.parallel_interactions
      )
  
      # Recorder
      if isinstance(recorder, str):
          recorder = dict(directory=recorder)
      if recorder is None:
          pass
      elif not all(
          key in ("directory", "frequency", "max-traces", "start")
          for key in recorder
      ):
          raise TensorforceError.value(
              name="Agent",
              argument="recorder values",
              value=list(recorder),
              hint="not from {directory,frequency,max-traces,start}",
          )
      self.recorder = recorder if recorder is None else dict(recorder)
  
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 1 to create a new Recorder object from inherited base classes: object with example: obj = Recorder(fn_act, states, actions, max_episode_timesteps, parallel_interactions, recorder)