class_docstr: This is a wrapper of any ASR transformer encoder. By default, the
  TransformerASR .forward() function encodes and decodes. With this wrapper
  the .forward() function becomes .encode() only.
  
  Important: The TransformerASR class must contain a .encode() function.
  
  Arguments
  ----------
  transformer : sb.lobes.models.TransformerInterface
      A Transformer instance that contains a .encode() function.
  
  Example
  -------
  >>> src = torch.rand([8, 120, 512])
  >>> tgt = torch.randint(0, 720, [8, 120])
  >>> net = TransformerASR(
  ...     720, 512, 512, 8, 1, 1, 1024, activation=torch.nn.GELU
  ... )
  >>> encoder = EncoderWrapper(net)
  >>> enc_out = encoder(src)
  >>> enc_out.shape
  torch.Size([8, 120, 512])
class_docstr_tok: ["This","is","a","wrapper","of","any","ASR","transformer","encoder",".","By","default",",","the","TransformerASR",".forward","(",")","function","encodes","and","decodes",".","With","this","wrapper","the",".forward","(",")","function","becomes",".encode","(",")","only",".","Important",":","The","TransformerASR","class","must","contain","a",".encode","(",")","function",".","Arguments","--","--","--","--","--","transformer",":","sb.lobes.models.TransformerInterface","A","Transformer","instance","that","contains","a",".encode","(",")","function",".","Example","--","--","--","-",">",">",">","src","=","torch.rand","(","[","8",",","120",",","512","]",")",">",">",">","tgt","=","torch.randint","(","0",",","720",",","[","8",",","120","]",")",">",">",">","net","=","TransformerASR","(","...","720",",","512",",","512",",","8",",","1",",","1",",","1024",",","activation=torch.nn.GELU","...",")",">",">",">","encoder","=","EncoderWrapper","(","net",")",">",">",">","enc_out","=","encoder","(","src",")",">",">",">","enc_out.shape","torch.Size","(","[","8",",","120",",","512","]",")"]
docstr: Processes the input tensor x and returns an output tensor.
docstr_tok: ["Processes","the","input","tensor","x","and","returns","an","output","tensor","."]
code: def forward(self, x, wav_lens=None, pad_idx=0, **kwargs):
      """Processes the input tensor x and returns an output tensor."""
      x = self.transformer.encode(
          x,
          wav_lens,
          pad_idx,
          **kwargs,
      )
      return x
  
imports: from dataclasses import dataclass
  import torch
  from torch import nn
  from typing import Any, Optional
  from speechbrain.nnet.linear import Linear
  from speechbrain.nnet.containers import ModuleList
  from speechbrain.lobes.models.transformer.Transformer import TransformerInterface, get_lookahead_mask, get_key_padding_mask, NormalizedEmbedding
  from speechbrain.nnet.activations import Swish
  from speechbrain.dataio.dataio import length_to_mask
  from speechbrain.utils.dynamic_chunk_training import DynChunkTrainConfig
label_desc: Use image node_id 2 for calling the EncoderWrapper obj's underlying member method code with example usage: obj.forward(x, wav_lens, pad_idx) and returns: x