class_docstr: Encoder layer block.
  
  In the original paper each operation (multi-head attention or FFN) is
  postprocessed with: `dropout -> add residual -> layernorm`. In the
  tensor2tensor code they suggest that learning is more robust when
  preprocessing each layer with layernorm and postprocessing with:
  `dropout -> add residual`. We default to the approach in the paper, but the
  tensor2tensor approach can be enabled by setting
  *cfg.encoder.normalize_before* to ``True``.
  
  Args:
      cfg (argparse.Namespace): parsed command-line arguments
class_docstr_tok: ["Encoder","layer","block",".","In","the","original","paper","each","operation","(","multi-head","attention","or","FFN",")","is","postprocessed","with",":","`","dropout","-",">","add","residual","-",">","layernorm","`",".","In","the","tensor2tensor","code","they","suggest","that","learning","is","more","robust","when","preprocessing","each","layer","with","layernorm","and","postprocessing","with",":","`","dropout","-",">","add","residual","`",".","We","default","to","the","approach","in","the","paper",",","but","the","tensor2tensor","approach","can","be","enabled","by","setting","*","cfg.encoder.normalize_before","*","to","``","True","``",".","Args",":","cfg","(","argparse.Namespace",")",":","parsed","command-line","arguments"]
code: def _prune_fc_layer(self, remove_index: List[int]):
      new_fc1_weight = []
      new_fc1_bias = []
      for i in range(self.fc1.out_features):
          if i not in remove_index:
              new_fc1_weight.append(self.fc1.weight[i])
              new_fc1_bias.append(self.fc1.bias[i])
  
      new_fc1_weight = torch.stack(new_fc1_weight).detach()
      new_fc1_weight.requires_grad = True
  
      new_fc1_bias = torch.stack(new_fc1_bias).detach()
      new_fc1_bias.requires_grad = True
  
      self.fc1 = quant_noise(
          nn.Linear(
              self.fc1.in_features,
              self.fc1.out_features - len(remove_index),
          ),
          p=self.quant_noise,
          block_size=self.quant_noise_block_size,
      )
      self.fc1.weight = torch.nn.Parameter(new_fc1_weight)
      self.fc1.bias = torch.nn.Parameter(new_fc1_bias)
  
      new_fc2_weight = []
      new_fc2_bias = []
      for i in range(self.fc2.in_features):
          if i not in remove_index:
              new_fc2_weight.append(self.fc2.weight[:, i])
      new_fc2_bias = self.fc2.bias.detach()
  
      new_fc2_weight = torch.stack(new_fc2_weight, dim=-1).detach()
      new_fc2_weight.requires_grad = True
  
      new_fc2_bias = self.fc2.bias.detach()
      new_fc2_bias.requires_grad = True
  
      self.fc2 = quant_noise(
          nn.Linear(
              self.fc2.in_features - len(remove_index),
              self.fc2.out_features,
          ),
          p=self.quant_noise,
          block_size=self.quant_noise_block_size,
      )
      self.fc2.weight = torch.nn.Parameter(new_fc2_weight)
      self.fc2.bias = torch.nn.Parameter(new_fc2_bias)
  
imports: from typing import Dict, List, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from fairseq import utils
  from fairseq.models.transformer import TransformerConfig
  from fairseq.modules import LayerNorm, MultiheadAttention
  from fairseq.modules.fairseq_dropout import FairseqDropout
  from fairseq.modules.quant_noise import quant_noise
label_desc: Use image node_id 5 for calling the TransformerEncoderLayerBase obj's underlying member method code with example usage: obj._prune_fc_layer(remove_index) without return types