class_docstr: This is an example input baseline generator for DocNN model which uses
  word and dict features.
class_docstr_tok: ["This","is","an","example","input","baseline","generator","for","DocNN","model","which","uses","word","and","dict","features","."]
docstr: Generates baseline for input word and dict features. In the future we
  will extend it to support char and other features as well.
  This baseline is entirely based on the `<pad>` token.
  
  Args
  
      integ_grads_embeddings: A reference to integrated gradients embedding
                              layer
      seq_length: The length of each sequence which depends on batch size
  
  Return
          baseline: A tuple of feature baselines
                    Each feature type has a corresponding baseline tensor
                    in the tuple.
                    Currently only Dict and Word feature types are supported
docstr_tok: ["Generates","baseline","for","input","word","and","dict","features",".","In","the","future","we","will","extend","it","to","support","char","and","other","features","as","well",".","This","baseline","is","entirely","based","on","the","`","<","pad",">","`","token",".","Args","integ_grads_embeddings",":","A","reference","to","integrated","gradients","embedding","layer","seq_length",":","The","length","of","each","sequence","which","depends","on","batch","size","Return","baseline",":","A","tuple","of","feature","baselines","Each","feature","type","has","a","corresponding","baseline","tensor","in","the","tuple",".","Currently","only","Dict","and","Word","feature","types","are","supported"]
code: def generate_baseline(self, integ_grads_embeddings, seq_length):
      r"""
      Generates baseline for input word and dict features. In the future we
      will extend it to support char and other features as well.
      This baseline is entirely based on the `<pad>` token.
  
      Args
  
          integ_grads_embeddings: A reference to integrated gradients embedding
                                  layer
          seq_length: The length of each sequence which depends on batch size
  
      Return
              baseline: A tuple of feature baselines
                        Each feature type has a corresponding baseline tensor
                        in the tuple.
                        Currently only Dict and Word feature types are supported
      """
      baseline = []
      for embedding in integ_grads_embeddings.embeddings:
          if isinstance(embedding, WordEmbedding):
              baseline.append(self._generate_word_baseline(seq_length))
          elif isinstance(embedding, DictEmbedding):
              baseline.append(self._generate_dict_baseline(seq_length))
          else:
              raise NotImplementedError(
                  "Currently only word and dict "
                  "embeddings are supported"
              )
      return tuple(baseline)
  
imports: from collections import defaultdict
  import torch
  from pytext.models.embeddings.dict_embedding import DictEmbedding
  from pytext.models.embeddings.word_embedding import WordEmbedding
  from pytext.models.model import EmbeddingBase, EmbeddingList
label_desc: Use image node_id 2 for calling the BaselineGenerator obj's underlying member method code with example usage: obj.generate_baseline(integ_grads_embeddings, seq_length) and returns: tuple