docstr: Resets parameter data pointer so that they can use faster code paths.
  
  Right now, this works only if the module is on the GPU and cuDNN is enabled.
  Otherwise, it's a no-op.
docstr_tok: ["Resets","parameter","data","pointer","so","that","they","can","use","faster","code","paths",".","Right","now",",","this","works","only","if","the","module","is","on","the","GPU","and","cuDNN","is","enabled",".","Otherwise",",","it","'s","a","no-op","."]
code: def flatten_parameters(self):
      """Resets parameter data pointer so that they can use faster code paths.
  
      Right now, this works only if the module is on the GPU and cuDNN is enabled.
      Otherwise, it's a no-op.
      """
      any_param = next(self.parameters()).data
      if (
          not any_param.is_cuda
          or not torch.backends.cudnn.is_acceptable(any_param)
      ):
          self._data_ptrs = []
          return
  
      # If any parameters alias, we fall back to the slower, copying code path. This is
      # a sufficient check, because overlapping parameter buffers that don't completely
      # alias would break the assumptions of the uniqueness check in
      # Module.named_parameters().
      unique_data_ptrs = set(
          p.data_ptr() for l in self.all_weights for p in l
      )
      if len(unique_data_ptrs) != sum(len(l) for l in self.all_weights):
          self._data_ptrs = []
          return
  
      with torch.cuda.device_of(any_param):
          import torch.backends.cudnn.rnn as rnn
  
          weight_arr = list(
              itertools.chain.from_iterable(self.all_weights)
          )
          weight_stride0 = len(self.all_weights[0])
  
          # NB: This is a temporary hack while we still don't have Tensor
          # bindings for ATen functions
          with torch.no_grad():
              # NB: this is an INPLACE function on weight_arr, that's why the
              # no_grad() is necessary.
              weight_buf = torch._cudnn_rnn_flatten_weight(
                  weight_arr,
                  weight_stride0,
                  self.input_size,
                  rnn.get_cudnn_mode(self.mode),
                  self.hidden_size,
                  self.proj_size,
                  self.num_layers,
                  self.batch_first,
                  bool(self.bidirectional),
              )
  
          self._param_buf_size = weight_buf.size(0)
          self._data_ptrs = list(
              p.data.data_ptr() for p in self.parameters()
          )
  
imports: import math
  import torch
  import warnings
  import itertools
  import numbers
  from torch import nn
  from torch.nn import Parameter
  from torch.nn.utils.rnn import PackedSequence
  from csrc.pytorch.pytorch_quantization import tensor_quant
  from csrc.pytorch.pytorch_quantization.nn._functions import quant_rnn
  from .None import _utils
label_desc: Use image node_id 2 for calling the QuantRNNBase obj's underlying member method code with example usage: obj.flatten_parameters() without return types