class_docstr: Encoder used to isolate features in raw audio for Wav2Vec style training.
  Treated as preprocessor module in NeMo ASR training. Defaults values are
  for base model found in Baeski et al (https://arxiv.org/abs/2006.11477),
  save for use of layer normalization as default schema. (Chosen for stability.) 
class_docstr_tok: ["Encoder","used","to","isolate","features","in","raw","audio","for","Wav2Vec","style","training",".","Treated","as","preprocessor","module","in","NeMo","ASR","training",".","Defaults","values","are","for","base","model","found","in","Baeski","et","al","(","https",":","\/\/arxiv.org\/abs\/2006.11477",")",",","save","for","use","of","layer","normalization","as","default","schema",".","(","Chosen","for","stability",".",")"]
code: def __init__(
      self,
      conv_layers: List[Dict[str, int]],
      extractor_mode: str = "layer_norm",
      conv_bias: bool = False,
      feature_grad_mult=1.0,
      normalize_audio=True,
      embedding_dim=768,
  ):
      super().__init__()
  
      self.grad_mult = feature_grad_mult
      self.normalize_input = normalize_audio
  
      def block(
          n_in,
          n_out,
          k,
          stride,
          is_layer_norm=False,
          is_group_norm=False,
          conv_bias=False,
      ):
          def make_conv():
              conv = nn.Conv1d(
                  n_in, n_out, k, stride=stride, bias=conv_bias
              )
              nn.init.kaiming_normal_(conv.weight)
              return conv
  
          assert (
              is_layer_norm and is_group_norm
          ) is False, "layer norm and group norm are exclusive"
  
          if is_layer_norm:
              return nn.Sequential(
                  make_conv(),
                  nn.Sequential(
                      TransposeLast(),
                      nn.LayerNorm(dim, elementwise_affine=True),
                      TransposeLast(),
                  ),
                  nn.GELU(),
              )
          elif is_group_norm:
              return nn.Sequential(
                  make_conv(),
                  nn.GroupNorm(dim, dim, affine=True),
                  nn.GELU(),
              )
          else:
              return nn.Sequential(make_conv(), nn.GELU())
  
      in_d = 1
      self.layer_cfg = conv_layers
      self.conv_layers = nn.ModuleList()
      self.mode = extractor_mode
      for i, cl in enumerate(conv_layers):
          assert len(cl) == 3, "invalid conv definition: " + str(cl)
          dim, k, stride = (
              cl["emb_dim"],
              cl["kernel_size"],
              cl["stride"],
          )
  
          self.conv_layers.append(
              block(
                  in_d,
                  dim,
                  k,
                  stride,
                  is_layer_norm=self.mode == "layer_norm",
                  is_group_norm=self.mode == "group_norm"
                  and i == 0,  # applied to first layer only
                  conv_bias=conv_bias,
              )
          )
          in_d = dim
  
      # Model Layers
      final_conv_dim = self.layer_cfg[-1][
          "emb_dim"
      ]  # Select last conv output layer dimension
      self.post_extract_proj = (  # To project feature encodings to transformer
          nn.Linear(final_conv_dim, embedding_dim)
          if final_conv_dim != embedding_dim
          else None
      )
      self.layer_norm = nn.LayerNorm(embedding_dim)
  
imports: import math
  import random
  from typing import Dict, List, Tuple
  import torch
  from omegaconf import DictConfig
  from omegaconf.dictconfig import DictConfig
  from torch import nn
  from torch.nn import functional
  from nemo.collections.common.parts import form_attention_mask, transformer_weights_init
  from nemo.collections.nlp.modules.common.transformer import TransformerEncoder
  from nemo.core.classes.module import NeuralModule
  from nemo.core.neural_types import AcousticEncodedRepresentation, AudioSignal, LengthsType, NeuralType, SpectrogramType
label_desc: Use image node_id 3 to create a new ConvFeatureEncoder object from inherited base classes: NeuralModule with example: obj = ConvFeatureEncoder(conv_layers, extractor_mode, conv_bias, feature_grad_mult, normalize_audio, embedding_dim)