class_docstr: We'll store weight_qparams for all the weights (weight_ih and weight_hh),
  we need to pass in a `weight_qparams_dict` that maps from weight name,
  e.g. weight_ih, to the weight_qparams for that weight
class_docstr_tok: ["We","'ll","store","weight_qparams","for","all","the","weights","(","weight_ih","and","weight_hh",")",",","we","need","to","pass","in","a","`","weight_qparams_dict","`","that","maps","from","weight","name",",","e.g",".","weight_ih",",","to","the","weight_qparams","for","that","weight"]
code: def forward(
      self, input: Tensor, hx: Optional[Tensor] = None
  ) -> Tensor:
      assert input.dim() in (
          1,
          2,
      ), f"RNNCell: Expected input to be 1-D or 2-D but received {input.dim()}-D tensor"
      is_batched = input.dim() == 2
      if not is_batched:
          input = input.unsqueeze(0)
  
      if hx is None:
          hx = torch.zeros(
              input.size(0),
              self.hidden_size,
              dtype=input.dtype,
              device=input.device,
          )
      else:
          hx = hx.unsqueeze(0) if not is_batched else hx
  
      if self.nonlinearity == "tanh":
          ret = _VF.rnn_tanh_cell(
              input,
              hx,
              self.get_weight_ih(),
              self.get_weight_hh(),
              self.bias_ih,
              self.bias_hh,
          )
      elif self.nonlinearity == "relu":
          ret = _VF.rnn_relu_cell(
              input,
              hx,
              self.get_weight_ih(),
              self.get_weight_hh(),
              self.bias_ih,
              self.bias_hh,
          )
      else:
          ret = input  # TODO: remove when jit supports exception flow
          raise RuntimeError(
              f"Unknown nonlinearity: {self.nonlinearity}"
          )
  
      if not is_batched:
          ret = ret.squeeze(0)
  
      return ret
  
imports: import torch
  import torch.nn
  from torch import Tensor
  from .utils import _quantize_and_dequantize_weight
  from .utils import _quantize_weight
  from typing import Optional, Dict, Any, Tuple
  from torch import _VF
  from torch.nn.utils.rnn import PackedSequence
label_desc: Use image node_id 3 for calling the RNNCell obj's underlying member method code with example usage: obj.forward(input, hx) and returns: ret