docstr: Initialize an attention transformer.
  
  Parameters
  ----------
  input_dim : int
      Input size
  group_dim : int
      Number of groups for features
  virtual_batch_size : int
      Batch size for Ghost Batch Normalization
  momentum : float
      Float value between 0 and 1 which will be used for momentum in batch norm
  mask_type : str
      Either "sparsemax" or "entmax" : this is the masking function to use
docstr_tok: ["Initialize","an","attention","transformer",".","Parameters","--","--","--","--","--","input_dim",":","int","Input","size","group_dim",":","int","Number","of","groups","for","features","virtual_batch_size",":","int","Batch","size","for","Ghost","Batch","Normalization","momentum",":","float","Float","value","between","0","and","1","which","will","be","used","for","momentum","in","batch","norm","mask_type",":","str","Either","``","sparsemax","''","or","``","entmax","''",":","this","is","the","masking","function","to","use"]
code: def __init__(
      self,
      input_dim,
      group_dim,
      group_matrix,
      virtual_batch_size=128,
      momentum=0.02,
      mask_type="sparsemax",
  ):
      """
      Initialize an attention transformer.
  
      Parameters
      ----------
      input_dim : int
          Input size
      group_dim : int
          Number of groups for features
      virtual_batch_size : int
          Batch size for Ghost Batch Normalization
      momentum : float
          Float value between 0 and 1 which will be used for momentum in batch norm
      mask_type : str
          Either "sparsemax" or "entmax" : this is the masking function to use
      """
      super(AttentiveTransformer, self).__init__()
      self.fc = Linear(input_dim, group_dim, bias=False)
      initialize_non_glu(self.fc, input_dim, group_dim)
      self.bn = GBN(
          group_dim,
          virtual_batch_size=virtual_batch_size,
          momentum=momentum,
      )
  
      if mask_type == "sparsemax":
          # Sparsemax
          self.selector = sparsemax.Sparsemax(dim=-1)
      elif mask_type == "entmax":
          # Entmax
          self.selector = sparsemax.Entmax15(dim=-1)
      else:
          raise NotImplementedError(
              "Please choose either sparsemax" + "or entmax as masktype"
          )
  
imports: import torch
  from torch.nn import Linear, BatchNorm1d, ReLU
  import numpy
  from pytorch_tabnet import sparsemax
label_desc: Use image node_id 1 to create a new AttentiveTransformer object from inherited base classes: torch.nn with example: obj = AttentiveTransformer(input_dim, group_dim, group_matrix, virtual_batch_size, momentum, mask_type)