class_docstr: Referance encoder for utterance and phoneme prosody encoders. Reference encoder
  made up of convolution and RNN layers.
  
  Args:
      num_mels (int): Number of mel frames to produce.
      ref_enc_filters (list[int]): List of channel sizes for encoder layers.
      ref_enc_size (int): Size of the kernel for the conv layers.
      ref_enc_strides (List[int]): List of strides to use for conv layers.
      ref_enc_gru_size (int): Number of hidden features for the gated recurrent unit.
  
  Inputs: inputs, mask
      - **inputs** (batch, dim, time): Tensor containing mel vector
      - **lengths** (batch): Tensor containing the mel lengths.
  Returns:
      - **outputs** (batch, time, dim): Tensor produced by Reference Encoder.
docstr: inputs --- [N,  n_mels, timesteps]
  outputs --- [N, E//2]
docstr_tok: ["inputs","--","-","[","N",",","n_mels",",","timesteps","]","outputs","--","-","[","N",",","E\/\/2","]"]
code: def forward(
      self, x: torch.Tensor, mel_lens: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      """
      inputs --- [N,  n_mels, timesteps]
      outputs --- [N, E//2]
      """
  
      mel_masks = get_mask_from_lengths(mel_lens).unsqueeze(1)
      x = x.masked_fill(mel_masks, 0)
      for conv, norm in zip(self.convs, self.norms):
          x = conv(x)
          x = F.leaky_relu(x, 0.3)  # [N, 128, Ty//2^K, n_mels//2^K]
          x = norm(x)
  
      for _ in range(2):
          mel_lens = stride_lens(mel_lens)
  
      mel_masks = get_mask_from_lengths(mel_lens)
  
      x = x.masked_fill(mel_masks.unsqueeze(1), 0)
      x = x.permute((0, 2, 1))
      x = torch.nn.utils.rnn.pack_padded_sequence(
          x,
          mel_lens.cpu().int(),
          batch_first=True,
          enforce_sorted=False,
      )
  
      self.gru.flatten_parameters()
      x, memory = self.gru(
          x
      )  # memory --- [N, Ty, E//2], out --- [1, N, E//2]
      x, _ = torch.nn.utils.rnn.pad_packed_sequence(x, batch_first=True)
  
      return x, memory, mel_masks
  
imports: from typing import List, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from TTS.tts.layers.delightful_tts.conformer import ConformerMultiHeadedSelfAttention
  from TTS.tts.layers.delightful_tts.conv_layers import CoordConv1d
  from TTS.tts.layers.delightful_tts.networks import STL
label_desc: Use image node_id 2 for calling the ReferenceEncoder obj's underlying member method code with example usage: obj.forward(x, mel_lens) and returns: x,  memory,  mel_masks