class_docstr: Introspective rationale generator used in paper
      
class_docstr_tok: ["Introspective","rationale","generator","used","in","paper"]
docstr: Initialize the IntrospectionGeneratorModule
  
  :param args: model structure parameters and hyperparameters
  :type args: ModelArguments
  :param classifier: an instantiated classifier module with an embedding
      layer and forward method
  :type classifier: an instantiated classifier module
      e.g. ClassifierModule
docstr_tok: ["Initialize","the","IntrospectionGeneratorModule",":","param","args",":","model","structure","parameters","and","hyperparameters",":","type","args",":","ModelArguments",":","param","classifier",":","an","instantiated","classifier","module","with","an","embedding","layer","and","forward","method",":","type","classifier",":","an","instantiated","classifier","module","e.g",".","ClassifierModule"]
code: def __init__(self, args, classifier):
      """Initialize the IntrospectionGeneratorModule
  
      :param args: model structure parameters and hyperparameters
      :type args: ModelArguments
      :param classifier: an instantiated classifier module with an embedding
          layer and forward method
      :type classifier: an instantiated classifier module
          e.g. ClassifierModule
      """
      super(IntrospectionGeneratorModule, self).__init__()
      self.args = args
  
      # for initializing RNN and DepGenerator
      self.input_dim = args.gen_embedding_dim
      self.hidden_dim = args.hidden_dim
      self.layer_num = args.layer_num
      self.dropout_rate = args.dropout_rate
      # for embedding labels
      self.num_labels = args.num_labels
      self.label_embedding_dim = args.label_embedding_dim
  
      # for training
      self.fixed_classifier = args.fixed_classifier
  
      self.NEG_INF = -1.0e6
      # should be shared with the Classifier_pred weights
      self.lab_embed_layer = self._create_label_embed_layer()
  
      # baseline classification model
      self.classifier = classifier
  
      self.Transformation = nn.Sequential()
      self.Transformation.add_module(
          "linear_layer",
          nn.Linear(
              self.hidden_dim + self.label_embedding_dim,
              self.hidden_dim // 2,
          ),
      )
      self.Transformation.add_module("tanh_layer", nn.Tanh())
      self.Generator = DepGenerator(
          self.input_dim,
          self.hidden_dim,
          self.layer_num,
          self.dropout_rate,
      )
  
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 1 to create a new IntrospectionGeneratorModule object from inherited base classes: nn with example: obj = IntrospectionGeneratorModule(args, classifier)