code: def prune_heads(self, heads):
      attention_head_size = self.d_model_size // self.num_heads
      if len(heads) == 0:
          return
      heads, index = find_pruneable_heads_and_indices(
          heads, self.num_heads, attention_head_size, self.pruned_heads
      )
  
      # Prune linear layers
      self.Wq = prune_linear_layer(self.Wq, index)
      self.Wk = prune_linear_layer(self.Wk, index)
      self.Wv = prune_linear_layer(self.Wv, index)
      self.dense = prune_linear_layer(self.dense, index, dim=1)
  
      # Update hyper params
      self.num_heads = self.num_heads - len(heads)
      self.d_model_size = attention_head_size * self.num_heads
      self.pruned_heads = self.pruned_heads.union(heads)
  
imports: from typing import Optional, Tuple, Union
  import numpy
  import torch
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...pytorch_utils import Conv1D, 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_ctrl import CTRLConfig
label_desc: Use image node_id 2 for calling the MultiHeadAttention obj's underlying member method code with example usage: obj.prune_heads(heads) without return types