class_docstr: A recurrent actor.
  
  An actor based on a recurrent policy which takes non-batched observations and
  outputs non-batched actions, and keeps track of the recurrent state inside. It
  also allows adding experiences to replay and updating the weights from the
  policy on the learner.
class_docstr_tok: ["A","recurrent","actor",".","An","actor","based","on","a","recurrent","policy","which","takes","non-batched","observations","and","outputs","non-batched","actions",",","and","keeps","track","of","the","recurrent","state","inside",".","It","also","allows","adding","experiences","to","replay","and","updating","the","weights","from","the","policy","on","the","learner","."]
code: def _policy(
      self,
      observation: types.NestedTensor,
      state: types.NestedTensor,
  ) -> Tuple[types.NestedTensor, types.NestedTensor]:
      # Add a dummy batch dimension and as a side effect convert numpy to TF.
      batched_observation = tf2_utils.add_batch_dim(observation)
  
      # Compute the policy, conditioned on the observation.
      policy, new_state = self._network(batched_observation, state)
  
      # Sample from the policy if it is stochastic.
      action = (
          policy.sample()
          if isinstance(policy, tfd.Distribution)
          else policy
      )
  
      return action, new_state
  
imports: from typing import Optional, Tuple
  from acme import adders
  from acme import core
  from acme import types
  from acme.tf import utils
  from acme.tf import variable_utils
  import dm_env
  import sonnet
  import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 2 for calling the RecurrentActor obj's underlying member method code with example usage: obj._policy(observation, state) and returns: action,  new_state