code: def whitelist_rnn_cells(handle, verbose):
      # Different module + function names in old/new RNN cases
      if has_old_rnns():
          fn_names = [
              "RNNReLUCell",
              "RNNTanhCell",
              "LSTMCell",
              "GRUCell",
          ]
          mod = torch.nn.backends.thnn.backend
      else:
          fn_names = [x + "_cell" for x in RNN_NAMES]
          mod = torch.nn.modules.rnn._VF
          assert isinstance(mod, VariableFunctionsShim)
  
      # Insert casts on cell functions
      for fn in fn_names:
          wrap.cached_cast(
              mod,
              fn,
              utils.maybe_half,
              handle,
              try_caching=True,
              verbose=verbose,
          )
  
      if has_old_rnns():
          # Special handling of `backward` for fused gru / lstm:
          # The `backward` method calls Tensor.sum() (blacklist) internally,
          # and then the resulting grad_input has the wrong type.
          # TODO: where else is this a problem?
          for rnn_type in ["GRUFused", "LSTMFused"]:
              mod = getattr(
                  torch.nn._functions.thnn.rnnFusedPointwise, rnn_type
              )
              wrap.disable_casts(mod, "backward", handle)
  
file_path: apex/apex/amp/rnn_compat.py
imports: from .None import utils, wrap
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: whitelist_rnn_cells(handle, verbose) without return types