class_docstr: Module for classifying text used in original paper code.
      
class_docstr_tok: ["Module","for","classifying","text","used","in","original","paper","code","."]
docstr: Forward pass in the classifier module
  :param X_tokens: tokenized and embedded text with shape
      (batch_size, length, embed_dim)
  :type X_tokens: torch Variable
  :param attention_mask: mask indicating word tokens (1) and padding (0)
      with shape (batch_size, length)
  :type attention_mask: torch.FloatTensor
  :param z: chosen rationales for sentence tokens (whether a given token
      is important for classification)
      with shape (batch_size, length), defaults to None
  :type z: torch.FloatTensor, optional
  :return: prediction (batch_size, num_label), word_embeddings, encoded
      input, None
  :rtype: tuple
docstr_tok: ["Forward","pass","in","the","classifier","module",":","param","X_tokens",":","tokenized","and","embedded","text","with","shape","(","batch_size",",","length",",","embed_dim",")",":","type","X_tokens",":","torch","Variable",":","param","attention_mask",":","mask","indicating","word","tokens","(","1",")","and","padding","(","0",")","with","shape","(","batch_size",",","length",")",":","type","attention_mask",":","torch.FloatTensor",":","param","z",":","chosen","rationales","for","sentence","tokens","(","whether","a","given","token","is","important","for","classification",")","with","shape","(","batch_size",",","length",")",",","defaults","to","None",":","type","z",":","torch.FloatTensor",",","optional",":","return",":","prediction","(","batch_size",",","num_label",")",",","word_embeddings",",","encoded","input",",","None",":","rtype",":","tuple"]
code: def forward(self, X_tokens, attention_mask, z=None):
      """Forward pass in the classifier module
      :param X_tokens: tokenized and embedded text with shape
          (batch_size, length, embed_dim)
      :type X_tokens: torch Variable
      :param attention_mask: mask indicating word tokens (1) and padding (0)
          with shape (batch_size, length)
      :type attention_mask: torch.FloatTensor
      :param z: chosen rationales for sentence tokens (whether a given token
          is important for classification)
          with shape (batch_size, length), defaults to None
      :type z: torch.FloatTensor, optional
      :return: prediction (batch_size, num_label), word_embeddings, encoded
          input, None
      :rtype: tuple
      """
      word_embeddings = self.embed_layer(X_tokens)
      if z is None:
          z = torch.ones_like(X_tokens)
          if torch.cuda.is_available():
              z = z.type(torch.cuda.FloatTensor)
          else:
              z = z.type(torch.FloatTensor)
  
      masked_input = word_embeddings * z.unsqueeze(-1)
      hiddens = self.encoder(masked_input, attention_mask)
  
      max_hidden = torch.max(
          hiddens
          + (1 - attention_mask * z).unsqueeze(1) * self.NEG_INF,
          dim=2,
      )[0]
  
      predict = self.predictor(max_hidden)
      # the last one is for attention in the BERT model
      return predict, [word_embeddings, hiddens], None
  
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 3 for calling the ClassifierModule obj's underlying member method code with example usage: obj.forward(X_tokens, attention_mask, z) and returns: predict,  list,  None