docstr: Computes forward pass through wav2vec model and returns encoded and
  target embeddings as well as other metrics of interest.
docstr_tok: ["Computes","forward","pass","through","wav2vec","model","and","returns","encoded","and","target","embeddings","as","well","as","other","metrics","of","interest","."]
code: def compute_forward(self, batch, stage):
      """Computes forward pass through wav2vec model and returns encoded and
      target embeddings as well as other metrics of interest.
      """
      wavs, wav_lens, mask = batch
      wavs, wav_lens, mask = (
          wavs.to(self.device),
          wav_lens.to(self.device),
          mask.to(self.device),
      )
      batch_size = wavs.size(0)
  
      # Mormalisation already done in dataloader
      # 1. Go through features extractor
      latents = self.modules.latent_extractor(
          wavs, normalize_signal=False
      )
  
      # 2. Go through latent (Transformer).
      results = self.modules.latent_encoder(
          latents,
          mask=mask,
          wav_lens=wav_lens,
      )
  
      embeddings = results["embeddings"]
  
      # 3. Mask some of the latent and projection
      embeddings = embeddings[mask]
      embeddings = self.modules.feat_proj(embeddings)
      results["embeddings"] = embeddings.view(
          batch_size, -1, embeddings.size(1)
      )
  
      latents = latents[mask].view(batch_size, -1, latents.size(2))
  
      # 4. Apply the quantiser as well
      targets, meta = self.modules.target_quantiser(latents)
      results.update(meta)
      results["targets"] = targets
      return results
  
imports: import logging
  import sys
  import time
  from functools import partial
  import speechbrain
  import torch
  import torch.nn.functional
  from torch.nn.parallel import DistributedDataParallel
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain import Stage
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.dataio.dataloader import SaveableDataLoader
  from speechbrain.dataio.sampler import DynamicBatchSampler
  from speechbrain.lobes.models.wav2vec import w2v_mask_collate_fn
  from speechbrain.lobes.models.wav2vec import sample_negatives
  from speechbrain.core import AMPConfig
label_desc: Use image node_id 1 for calling the W2V2Brain obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: results