code: def __init__(self, other, dtype=torch.int8):
      super().__init__()
      warnings.warn(
          "torch.jit.QuantizedRNNBase is deprecated and will be removed in an upcoming "
          "PyTorch release. Please use the torch.ao.nn.quantized.dynamic instead."
      )
      self.mode = other.mode
      self.input_size = other.input_size
      self.hidden_size = other.hidden_size
      self.num_layers = other.num_layers
      self.bias = other.bias
      self.batch_first = other.batch_first
      if self.mode != "GRU":
          assert not self.batch_first
      self.dropout = other.dropout
      self.bidirectional = other.bidirectional
      num_directions = 2 if self.bidirectional else 1
      self.dtype = dtype
  
      assert self.bias
  
      # TODO: support more than just LSTM
      if self.mode != "LSTM" and self.mode != "GRU":
          raise RuntimeError(
              "Only LSTM or GRU is supported for QuantizedRNN"
          )
  
      if dtype != torch.int8 and dtype != torch.float16:
          raise RuntimeError(f"Unsupported dtype: {dtype}")
  
      self.all_weights = []
      for layer in range(self.num_layers):
          for direction in range(num_directions):
              layer_input_size = (
                  self.input_size
                  if layer == 0
                  else self.hidden_size * num_directions
              )
  
              suffix = "_reverse" if direction == 1 else ""
  
              def get_weight_bias(ihhh):
                  weight_name = f"weight_{ihhh}_l{layer}{suffix}"
                  bias_name = f"bias_{ihhh}_l{layer}{suffix}"
  
                  weight = getattr(other, weight_name)
                  bias = getattr(other, bias_name)
                  return weight, bias
  
              weight_ih, bias_ih = get_weight_bias("ih")
              weight_hh, bias_hh = get_weight_bias("hh")
  
              if dtype == torch.int8:
                  cell_params = (
                      torch.ops.quantized.make_quantized_cell_params(
                          weight_ih, weight_hh, bias_ih, bias_hh
                      )
                  )
              else:
                  packed_ih = torch.ops.quantized.linear_prepack_fp16(
                      weight_ih.float(), bias_ih
                  )
                  packed_hh = torch.ops.quantized.linear_prepack_fp16(
                      weight_hh.float(), bias_hh
                  )
  
                  cell_params = torch.ops.quantized.make_quantized_cell_params_fp16(
                      packed_ih, packed_hh
                  )
  
              setattr(
                  self, f"cell_params_{layer}_{suffix}", cell_params
              )
              self.all_weights.append(cell_params)
  
imports: import warnings
  from typing import List, Optional, Tuple
  import torch
  from torch import _VF, Tensor
  from torch.nn.utils.rnn import PackedSequence
label_desc: Use image node_id 1 to create a new QuantizedRNNBase object from inherited base classes: torch.jit with example: obj = QuantizedRNNBase(other, dtype)