class_docstr: Vanilla self-attention
class_docstr_tok: ["Vanilla","self-attention"]
code: def __init__(
      self,
      embed_dim,  # Hidden dimensionality
      num_heads=8,  # Number of attention heads
      qkv_bias=False,  # Query, key, and value bias
      qk_scale=None,  # Scale query and key
      attention_dropout_rate=0.0,  # Dropout on attention
      proj_dropout_rate=0.0,  # Post-attention dropout on linear
      # projection
  ):
      super().__init__()
      self.num_heads = num_heads
      head_dim = embed_dim // num_heads
      self.scale = qk_scale or head_dim**-0.5
  
      self.qkv = nn.Linear(embed_dim, embed_dim * 3, bias=qkv_bias)
      self.attn_drop = nn.Dropout(attention_dropout_rate)
      self.proj = nn.Linear(embed_dim, embed_dim)
      self.proj_drop = nn.Dropout(proj_dropout_rate)
      self.apply(self._init_weights)
  
imports: import copy
  import logging
  import math
  import torch
  import torch.nn
  from vissl.models.model_helpers import DropPath, to_2tuple, trunc_normal_
  from vissl.models.trunks import register_model_trunk
  from vissl.utils.hydra_config import AttrDict
label_desc: Use image node_id 1 to create a new SelfAttention object from inherited base classes: nn with example: obj = SelfAttention(embed_dim, num_heads, qkv_bias, qk_scale, attention_dropout_rate, proj_dropout_rate)