class_docstr: Base class for all RNN-like sequence models.
  
  DP-friendly drop-in replacement of the ``torch.nn.RNNBase`` module.
  After training this module can be exported and loaded by the original ``torch.nn``
  implementation for inference.
  
  This module implements multi-layer (Type-2, see
  [this issue](https://github.com/pytorch/pytorch/issues/4930#issuecomment-361851298))
  bi-directional sequential model based on abstract cell.
  Cell should be a subclass of ``DPRNNCellBase``.
  
  Limitations:
  - proj_size > 0 is not implemented
  - this implementation doesn't use cuDNN
class_docstr_tok: ["Base","class","for","all","RNN-like","sequence","models",".","DP-friendly","drop-in","replacement","of","the","``","torch.nn.RNNBase","``","module",".","After","training","this","module","can","be","exported","and","loaded","by","the","original","``","torch.nn","``","implementation","for","inference",".","This","module","implements","multi-layer","(","Type-2",",","see","[","this","issue","]","(","https",":","\/\/github.com\/pytorch\/pytorch\/issues\/4930","#","issuecomment-361851298",")",")","bi-directional","sequential","model","based","on","abstract","cell",".","Cell","should","be","a","subclass","of","``","DPRNNCellBase","``",".","Limitations",":","-","proj_size",">","0","is","not","implemented","-","this","implementation","does","n't","use","cuDNN"]
code: def initialize_cells(self):
      cells = []
      rename_map = {}
      for layer, directions in self.iterate_layers():
          for direction, _ in directions:
              layer_input_size = (
                  self.input_size
                  if layer == 0
                  else self.hidden_size * self.num_directions
              )
  
              cell = self.cell_type(
                  layer_input_size,
                  self.hidden_size,
                  bias=self.bias,
                  **self.cell_params,
              )
              cells.append(cell)
  
              suffix = "_reverse" if direction == 1 else ""
              cell_name = f"l{layer}{suffix}"
              setattr(self, cell_name, cell)
  
              components = ["weight"] + ["bias" if self.bias else []]
              matrices = ["ih", "hh"]
              for c in components:
                  for m in matrices:
                      rename_map[
                          f"{cell_name}.{m}.{c}"
                      ] = f"{c}_{m}_{cell_name}"
  
      self.set_rename_map(rename_map)
      return cells
  
imports: import math
  import numbers
  import warnings
  from typing import List, Optional, Tuple, Type, Union
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn.utils.rnn import PackedSequence
  from ..utils.packed_sequences import compute_seq_lengths
  from .param_rename import RenameParamsMixin
label_desc: Use image node_id 5 for calling the DPRNNBase obj's underlying member method code with example usage: obj.initialize_cells() and returns: cells