code: def _get_feature_extractor(
      norm_mode: str,
      shapes: List[Tuple[int, int, int]],
      bias: bool,
  ) -> FeatureExtractor:
      """
      Args:
          norm_mode (str):
              Either "group_norm" or "layer_norm".
              If "group_norm", then a single normalization is applied
              in the first convolution block. Otherwise, all the convolution
              blocks will have layer normalization.
              This option corresponds to "extractor_mode" from fairseq.
              Expected values are "group_norm" for Base arch, and
              "layer_norm" for Large arch.
          shapes (list of tuple of int):
              Configuration of convolution layers. List of convolution configuration,
              i.e. ``[(output_channel, kernel_size, stride), ...]``
              This option corresponds to "conv_feature_layers" from fairseq.
              Expected values are
              ``[(512, 10, 5)] + [(512, 3, 2)] * 4 + [(512, 2, 2)] * 2``
              for all the architectures.
          bias (bool):
              Whether to include bias term to each convolution operation.
              This option corresponds to "conv_bias" from fairseq.
              Expected values are False for Base arch, and True for Large arch.
  
      See Also:
          * Original implementation
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/fairseq/models/wav2vec/wav2vec2.py#L666-L733
          * "extractor_mode"
            - Def and base:
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/fairseq/models/wav2vec/wav2vec2.py#L38-L45
            - Large:
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/examples/wav2vec/config/pretraining/wav2vec2_large_librivox.yaml#L52
          * "conv_feature_layers"
            - Def, base and large:
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/fairseq/models/wav2vec/wav2vec2.py#L94-L100
          * "conv_bias"
            - Def and base:
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/fairseq/models/wav2vec/wav2vec2.py#L101-L103
            - Large:
              https://github.com/pytorch/fairseq/blob/425c36eafff535fe7337f8bdd5ace22ebacc78cb/examples/wav2vec/config/pretraining/wav2vec2_large_librivox.yaml#L61
      """
      if norm_mode not in ["group_norm", "layer_norm"]:
          raise ValueError("Invalid norm mode")
      blocks = []
      in_channels = 1
      for i, (out_channels, kernel_size, stride) in enumerate(shapes):
          normalization = None
          if norm_mode == "group_norm" and i == 0:
              normalization = nn.GroupNorm(
                  num_groups=out_channels,
                  num_channels=out_channels,
                  affine=True,
              )
          elif norm_mode == "layer_norm":
              normalization = LayerNorm(
                  normalized_shape=out_channels,
                  elementwise_affine=True,
              )
          blocks.append(
              ConvLayerBlock(
                  in_channels=in_channels,
                  out_channels=out_channels,
                  kernel_size=kernel_size,
                  stride=stride,
                  bias=bias,
                  layer_norm=normalization,
              )
          )
          in_channels = out_channels
      return FeatureExtractor(nn.ModuleList(blocks))
  
imports: import logging
  from typing import List, Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import Module, Parameter
  from .wavlm_attention import WavLMSelfAttention
label_desc: Use image node_id 2 for calling a global function with example usage: _get_feature_extractor(norm_mode, shapes, bias) and returns: FeatureExtractor