class_docstr: Tensorforce agent interface.
class_docstr_tok: ["Tensorforce","agent","interface","."]
code: def fn_act(
      self,
      states,
      internals,
      parallel,
      independent,
      deterministic,
      is_internals_none,
      num_parallel,
  ):
      # Separate auxiliaries
      def function(name, spec):
          auxiliary = ArrayDict()
          if (
              self.config.enable_int_action_masking
              and spec.type == "int"
              and spec.num_values is not None
          ):
              if name is None:
                  name = "action"
              # Mask, either part of states or default all true
              auxiliary["mask"] = states.pop(
                  name + "_mask",
                  np.ones(
                      shape=(num_parallel,)
                      + spec.shape
                      + (spec.num_values,),
                      dtype=spec.np_type(),
                  ),
              )
          return auxiliary
  
      auxiliaries = self.actions_spec.fmap(
          function=function, cls=ArrayDict, with_names=True
      )
      if self.states_spec.is_singleton() and not states.is_singleton():
          states[None] = states.pop("state")
  
      # Inputs to tensors
      states = self.states_spec.to_tensor(
          value=states, batched=True, name="Agent.act states"
      )
      if independent and not is_internals_none:
          internals = self.internals_spec.to_tensor(
              value=internals,
              batched=True,
              recover_empty=True,
              name="Agent.act internals",
          )
      auxiliaries = self.auxiliaries_spec.to_tensor(
          value=auxiliaries, batched=True, name="Agent.act auxiliaries"
      )
      if independent:
          deterministic = self.deterministic_spec.to_tensor(
              value=deterministic,
              batched=False,
              name="Agent.act deterministic",
          )
      else:
          parallel = self.parallel_spec.to_tensor(
              value=parallel, batched=True, name="Agent.act parallel"
          )
  
      # Model.act()
      if not independent:
          actions, timesteps = self.model.act(
              states=states, auxiliaries=auxiliaries, parallel=parallel
          )
          self.timesteps = timesteps.numpy().item()
  
      elif len(self.internals_spec) > 0:
          if len(self.auxiliaries_spec) > 0:
              actions, internals = self.model.independent_act(
                  states=states,
                  internals=internals,
                  auxiliaries=auxiliaries,
                  deterministic=deterministic,
              )
          else:
              assert len(auxiliaries) == 0
              actions, internals = self.model.independent_act(
                  states=states,
                  internals=internals,
                  deterministic=deterministic,
              )
  
      else:
          if len(self.auxiliaries_spec) > 0:
              actions = self.model.independent_act(
                  states=states,
                  auxiliaries=auxiliaries,
                  deterministic=deterministic,
              )
          else:
              assert len(auxiliaries) == 0
              actions = self.model.independent_act(
                  states=states, deterministic=deterministic
              )
  
      # Outputs from tensors
      actions = self.actions_spec.from_tensor(
          tensor=actions, batched=True, name="Agent.act output actions"
      )
      if independent and len(self.internals_spec) > 0:
          internals = self.internals_spec.from_tensor(
              tensor=internals,
              batched=True,
              name="Agent.act output internals",
          )
  
      if self.model.saver is not None:
          self.model.save()
  
      return actions, internals
  
imports: from collections import OrderedDict
  import json
  import logging
  import os
  import random
  import numpy
  import tensorflow
  from tensorforce import util, TensorforceError
  from tensorforce.agents import Recorder
  import tensorforce.agents
  from tensorforce.core import ArrayDict, TensorSpec, TensorforceConfig
label_desc: Use image node_id 13 for calling the Agent obj's underlying member method code with example usage: obj.fn_act(states, internals, parallel, independent, deterministic, is_internals_none, num_parallel) and returns: actions,  internals, auxiliary