code: def detach_recurrent_state(recurrent_state):
      """Detach recurrent state.
  
      Args:
          recurrent_state (object): Recurrent state in torch.Tensor.
  
      Returns:
          object: Detached recurrent state.
      """
      if recurrent_state is None:
          return
      elif isinstance(recurrent_state, torch.Tensor):
          return recurrent_state.detach()
      elif isinstance(recurrent_state, tuple):
          return tuple(
              detach_recurrent_state(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 16 for calling a global function with example usage: detach_recurrent_state(recurrent_state) and returns: recurrent_state, tuple