class_docstr: Creates a recurrent actor network.
code: def call(
      self, observation, step_type, network_state=(), training=False
  ):
      num_outer_dims = nest_utils.get_outer_rank(
          observation, self.input_tensor_spec
      )
      if num_outer_dims not in (1, 2):
          raise ValueError(
              "Input observation must have a batch or batch x time outer shape."
          )
  
      has_time_dim = num_outer_dims == 2
      if not has_time_dim:
          # Add a time dimension to the inputs.
          observation = tf.nest.map_structure(
              lambda t: tf.expand_dims(t, 1), observation
          )
          step_type = tf.nest.map_structure(
              lambda t: tf.expand_dims(t, 1), step_type
          )
  
      states = tf.cast(tf.nest.flatten(observation)[0], tf.float32)
      batch_squash = utils.BatchSquash(2)  # Squash B, and T dims.
      states = batch_squash.flatten(
          states
      )  # [B, T, ...] -> [B x T, ...]
  
      for layer in self._input_layers:
          states = layer(states, training=training)
  
      states = batch_squash.unflatten(
          states
      )  # [B x T, ...] -> [B, T, ...]
  
      with tf.name_scope("reset_mask"):
          reset_mask = tf.equal(step_type, time_step.StepType.FIRST)
      # Unroll over the time sequence.
      states, network_state = self._dynamic_unroll(
          states,
          reset_mask=reset_mask,
          initial_state=network_state,
          training=training,
      )
  
      states = batch_squash.flatten(
          states
      )  # [B, T, ...] -> [B x T, ...]
  
      for layer in self._output_layers:
          states = layer(states, training=training)
  
      actions = []
      for layer, spec in zip(
          self._action_layers, self._flat_action_spec
      ):
          action = layer(states, training=training)
          action = common.scale_to_spec(action, spec)
          action = batch_squash.unflatten(
              action
          )  # [B x T, ...] -> [B, T, ...]
          if not has_time_dim:
              action = tf.squeeze(action, axis=1)
          actions.append(action)
  
      output_actions = tf.nest.pack_sequence_as(
          self._output_tensor_spec, actions
      )
      return output_actions, network_state
  
file_path: agents/tf_agents/agents/ddpg/actor_rnn_network.py
imports: import functools
  import gin
  import tensorflow
  from tf_agents.keras_layers import dynamic_unroll_layer
  from tf_agents.networks import network
  from tf_agents.networks import utils
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 2 for calling the ActorRnnNetwork obj's underlying member method code with example usage: obj.call(observation, step_type, network_state, training) and returns: output_actions,  network_state