class_docstr: RNN Module
      
class_docstr_tok: ["RNN","Module"]
docstr: Forward pass in the RNN.
  :param embeddings: sequence of word embeddings with dimension
      (batch_size, sequence_length, embedding_dim)
  :type embeddings: torch.FloatTensor
  :param mask: a float tensor of masks with dimension
      (batch_size, length), defaults to None
  :type mask: torch.FloatTensor, optional
  :param h0: initial RNN weights with dimension
      (num_layers * num_directions, batch, hidden_size), defaults to None
  :type h0: torch.FloatTensor, optional
  :return: hiddens, a sentence embedding tensor with dimension
      (batch_size, hidden_dim, sequence_length)
  :rtype: torch.FloatTensor
docstr_tok: ["Forward","pass","in","the","RNN",".",":","param","embeddings",":","sequence","of","word","embeddings","with","dimension","(","batch_size",",","sequence_length",",","embedding_dim",")",":","type","embeddings",":","torch.FloatTensor",":","param","mask",":","a","float","tensor","of","masks","with","dimension","(","batch_size",",","length",")",",","defaults","to","None",":","type","mask",":","torch.FloatTensor",",","optional",":","param","h0",":","initial","RNN","weights","with","dimension","(","num_layers","*","num_directions",",","batch",",","hidden_size",")",",","defaults","to","None",":","type","h0",":","torch.FloatTensor",",","optional",":","return",":","hiddens",",","a","sentence","embedding","tensor","with","dimension","(","batch_size",",","hidden_dim",",","sequence_length",")",":","rtype",":","torch.FloatTensor"]
code: def forward(self, embeddings, mask=None, h0=None):
      """Forward pass in the RNN.
      :param embeddings: sequence of word embeddings with dimension
          (batch_size, sequence_length, embedding_dim)
      :type embeddings: torch.FloatTensor
      :param mask: a float tensor of masks with dimension
          (batch_size, length), defaults to None
      :type mask: torch.FloatTensor, optional
      :param h0: initial RNN weights with dimension
          (num_layers * num_directions, batch, hidden_size), defaults to None
      :type h0: torch.FloatTensor, optional
      :return: hiddens, a sentence embedding tensor with dimension
          (batch_size, hidden_dim, sequence_length)
      :rtype: torch.FloatTensor
      """
      # dimensions: (sequence_length, batch_size, embedding_dim)
      embeddings_ = embeddings.transpose(0, 1)
  
      if mask is not None:
          seq_lengths = list(torch.sum(mask, dim=1).cpu().data.numpy())
          seq_lengths = list(map(int, seq_lengths))
          inputs_ = torch.nn.utils.rnn.pack_padded_sequence(
              embeddings_, seq_lengths
          )
      else:
          inputs_ = embeddings_
  
      if h0 is not None:
          hidden, _ = self.rnn_layer(inputs_, h0)
      else:
          # hidden's dimensions:
          # (sequence_length, batch_size, hidden_dim (* 2 if bidirectional))
          hidden, _ = self.rnn_layer(inputs_)
  
      if mask is not None:
          # hidden's dimensions: (length, batch_size, hidden_dim)
          hidden, _ = torch.nn.utils.rnn.pad_packed_sequence(hidden)
  
      # output dimensions: (batch_size, hidden_dim, sequence_length)
      return hidden.permute(1, 2, 0)
  
imports: import os
  import logging
  import numpy
  import torch
  import torch.nn
  from torch.autograd import Variable
  from tqdm import tqdm
  from interpret_text.experimental.common.utils_introspective_rationale import generate_data
label_desc: Use image node_id 2 for calling the RnnModel obj's underlying member method code with example usage: obj.forward(embeddings, mask, h0) and returns: hidden