code: def prune_heads(self, heads: Set[int]) -> None:
      if len(heads) == 0:
          return
      heads, index = find_pruneable_heads_and_indices(
          heads,
          self.attention.num_attention_heads,
          self.attention.attention_head_size,
          self.pruned_heads,
      )
  
      # Prune linear layers
      self.attention.query = prune_linear_layer(
          self.attention.query, index
      )
      self.attention.key = prune_linear_layer(self.attention.key, index)
      self.attention.value = prune_linear_layer(
          self.attention.value, index
      )
      self.output.dense = prune_linear_layer(
          self.output.dense, index, dim=1
      )
  
      # Update hyper params and store pruned heads
      self.attention.num_attention_heads = (
          self.attention.num_attention_heads - len(heads)
      )
      self.attention.all_head_size = (
          self.attention.attention_head_size
          * self.attention.num_attention_heads
      )
      self.pruned_heads = self.pruned_heads.union(heads)
  
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 2 for calling the VivitAttention obj's underlying member method code with example usage: obj.prune_heads(heads) without return types