code: def __init__(self, config: VivitConfig) -> None:
      super().__init__()
      if (
          config.hidden_size % config.num_attention_heads != 0
          and not hasattr(config, "embedding_size")
      ):
          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.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, bias=config.qkv_bias
      )
      self.key = nn.Linear(
          config.hidden_size, self.all_head_size, bias=config.qkv_bias
      )
      self.value = nn.Linear(
          config.hidden_size, self.all_head_size, bias=config.qkv_bias
      )
  
      self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
  
imports: import math
  from typing import Optional, Set, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, ImageClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_vivit import VivitConfig
label_desc: Use image node_id 1 to create a new VivitSelfAttention object from inherited base classes: nn with example: obj = VivitSelfAttention(config)