class_docstr: An Elman RNN cell with tanh or ReLU non-linearity.
  
  DP-friendly drop-in replacement of the ``torch.nn.RNNCell`` module to use in ``DPRNN``.
  Refer to ``torch.nn.RNNCell`` documentation for the model description, parameters and inputs/outputs.
class_docstr_tok: ["An","Elman","RNN","cell","with","tanh","or","ReLU","non-linearity",".","DP-friendly","drop-in","replacement","of","the","``","torch.nn.RNNCell","``","module","to","use","in","``","DPRNN","``",".","Refer","to","``","torch.nn.RNNCell","``","documentation","for","the","model","description",",","parameters","and","inputs\/outputs","."]
code: def forward(
      self,
      input: Tensor,
      hx: Optional[Tensor] = None,
      batch_size_t: Optional[int] = None,
  ) -> Tensor:
      if hx is None:
          hx = torch.zeros(
              input.shape[0],
              self.hidden_size,
              dtype=input.dtype,
              device=input.device,
          )
  
      h_prev = hx
      gates = self.ih(input) + self.hh(
          h_prev if batch_size_t is None else h_prev[:batch_size_t, :]
      )
      if self.nonlinearity == "tanh":
          h_t = torch.tanh(gates)
      elif self.nonlinearity == "relu":
          h_t = torch.relu(gates)
      else:
          raise RuntimeError(
              f"Unknown nonlinearity: {self.nonlinearity}"
          )
      return h_t
  
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 2 for calling the DPRNNCell obj's underlying member method code with example usage: obj.forward(input, hx, batch_size_t) and returns: h_t