class_docstr: RNN embedding class: apply the RNN network to a sequence of word embeddings.
  
  Parameters
  ----------
  input_size : int
      The input feature size.
  hidden_size : int
      The hidden layer size.
  dropout : float, optional
      Dropout ratio, default: ``None``.
  bidirectional : boolean, optional
      Whether to use bidirectional RNN, default: ``False``.
  rnn_type : str
      The RNN cell type, default: ``lstm``.
class_docstr_tok: ["RNN","embedding","class",":","apply","the","RNN","network","to","a","sequence","of","word","embeddings",".","Parameters","--","--","--","--","--","input_size",":","int","The","input","feature","size",".","hidden_size",":","int","The","hidden","layer","size",".","dropout",":","float",",","optional","Dropout","ratio",",","default",":","``","None","``",".","bidirectional",":","boolean",",","optional","Whether","to","use","bidirectional","RNN",",","default",":","``","False","``",".","rnn_type",":","str","The","RNN","cell","type",",","default",":","``","lstm","``","."]
code: def __init__(
      self,
      input_size,
      hidden_size,
      bidirectional=False,
      num_layers=1,
      rnn_type="lstm",
      dropout=None,
  ):
      super(RNNEmbedding, self).__init__()
      if rnn_type not in ("lstm", "gru"):
          raise RuntimeError(
              "rnn_type is expected to be lstm or gru, got {}".format(
                  rnn_type
              )
          )
  
      # if bidirectional:
      #     print('[ Using bidirectional {} encoder ]'.format(rnn_type))
      # else:
      #     print('[ Using {} encoder ]'.format(rnn_type))
  
      if bidirectional and hidden_size % 2 != 0:
          raise RuntimeError(
              "hidden_size is expected to be even in the bidirectional mode!"
          )
  
      self.dropout = dropout
      self.rnn_type = rnn_type
      self.num_layers = num_layers
      self.num_directions = 2 if bidirectional else 1
      self.hidden_size = (
          hidden_size // 2 if bidirectional else hidden_size
      )
      model = nn.LSTM if rnn_type == "lstm" else nn.GRU
      self.model = model(
          input_size,
          self.hidden_size,
          num_layers,
          batch_first=True,
          bidirectional=bidirectional,
      )
  
imports: import torch
  from torch import nn
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  from ...data.data import from_batch
  from ..utils.bert_utils import convert_text_to_bert_features, extract_bert_hidden_states
  from ..utils.generic_utils import dropout_fn
  from ..utils.padding_utils import pad_4d_vals
  from ..utils.vocab_utils import Vocab
label_desc: Use image node_id 1 to create a new RNNEmbedding object from inherited base classes: nn with example: obj = RNNEmbedding(input_size, hidden_size, bidirectional, num_layers, rnn_type, dropout)