code: def recurrent_state_as_numpy(recurrent_state):
      """Convert a recurrent state in torch.Tensor to numpy.ndarray.
  
      Args:
          recurrent_state (object): Recurrent state in torch.Tensor.
  
      Returns:
          object: Recurrent state in numpy.ndarray.
      """
      if recurrent_state is None:
          return None
      elif isinstance(recurrent_state, torch.Tensor):
          return recurrent_state.detach().cpu().numpy()
      elif isinstance(recurrent_state, tuple):
          return tuple(
              recurrent_state_as_numpy(s) for s in recurrent_state
          )
      else:
          raise ValueError(
              "Invalid recurrent state: {}".format(recurrent_state)
          )
  
file_path: pfrl/pfrl/utils/recurrent.py
imports: import itertools
  import numpy
  import torch
  from torch import nn
label_desc: Use image node_id 14 for calling a global function with example usage: recurrent_state_as_numpy(recurrent_state) and returns: None, recurrent_state, tuple