code: def __init__(
      self, config: Config, n_input: int, batch_first: bool = True
  ) -> None:
      super().__init__()
  
      self.batch_first = batch_first
      self.attention_type = config.attention_type
  
      # attention can be in the form of h1'Wh2 ("multiply"),
      # g(h1;h2) ("add") or h1'h2 ("dot")
      if self.attention_type == SlotAttentionType.CONCAT:
          self.attention_add = nn.Sequential(
              nn.Linear(2 * n_input, config.attn_dimension, bias=False),
              nn.Tanh(),
              nn.Linear(config.attn_dimension, 1, bias=False),
          )
      elif self.attention_type == SlotAttentionType.MULTIPLY:
          self.attention_mult = nn.Linear(n_input, n_input, bias=False)
      log_class_usage(__class__)
  
file_path: pytext/pytext/models/representations/slot_attention.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from pytext.config import ConfigBase
  from pytext.config.module_config import SlotAttentionType
  from pytext.models.module import Module
  from pytext.utils.usage import log_class_usage
  from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence
label_desc: Use image node_id 1 to create a new SlotAttention object from inherited base classes: Module with example: obj = SlotAttention(config, n_input, batch_first)