class_docstr: Self-attention mechanism.
class_docstr_tok: ["Self-attention","mechanism","."]
code: def __init__(self, config):
      super().__init__()
      if config.hidden_size % config.num_attention_heads != 0:
          raise ValueError(
              f"The hidden size {config.hidden_size} is not a multiple of the number of attention "
              f"heads {config.num_attention_heads}"
          )
      self.output_attentions = False
  
      self.num_attention_heads = config.num_attention_heads
      self.attention_head_size = int(
          config.hidden_size / config.num_attention_heads
      )
      self.all_head_size = (
          self.num_attention_heads * self.attention_head_size
      )
  
      self.query = nn.Linear(config.hidden_size, self.all_head_size)
      self.key = nn.Linear(config.hidden_size, self.all_head_size)
      self.value = nn.Linear(config.hidden_size, self.all_head_size)
  
      self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import logging
  import math
  import torch
  from torch import nn
  from towhee.models.layers.activations import swish, gelu
label_desc: Use image node_id 1 to create a new BertSelfAttention object from inherited base classes: nn with example: obj = BertSelfAttention(config)