docstr: Evaluate one batch, override for different procedure than train.
  
  The default implementation depends on two methods being defined
  with a particular behavior:
  
  * ``compute_forward()``
  * ``compute_objectives()``
  
  Arguments
  ---------
  batch : list of torch.Tensors
      Batch of data to use for evaluation. Default implementation assumes
      this batch has two elements: inputs and targets.
  stage : Stage
      The stage of the experiment: Stage.VALID, Stage.TEST
  
  Returns
  -------
  detached loss
docstr_tok: ["Evaluate","one","batch",",","override","for","different","procedure","than","train",".","The","default","implementation","depends","on","two","methods","being","defined","with","a","particular","behavior",":","*","``","compute_forward","(",")","``","*","``","compute_objectives","(",")","``","Arguments","--","--","--","--","-","batch",":","list","of","torch.Tensors","Batch","of","data","to","use","for","evaluation",".","Default","implementation","assumes","this","batch","has","two","elements",":","inputs","and","targets",".","stage",":","Stage","The","stage","of","the","experiment",":","Stage.VALID",",","Stage.TEST","Returns","--","--","--","-","detached","loss"]
code: def evaluate_batch(self, batch, stage):
      """Evaluate one batch, override for different procedure than train.
  
      The default implementation depends on two methods being defined
      with a particular behavior:
  
      * ``compute_forward()``
      * ``compute_objectives()``
  
      Arguments
      ---------
      batch : list of torch.Tensors
          Batch of data to use for evaluation. Default implementation assumes
          this batch has two elements: inputs and targets.
      stage : Stage
          The stage of the experiment: Stage.VALID, Stage.TEST
  
      Returns
      -------
      detached loss
      """
      noisy_wavs, lens = batch.noisy_sig
      clean_wavs, lens = batch.clean_sig
      self.batch_current = clean_wavs.shape[0]
      self.original_len = clean_wavs.shape[1]
  
      # Add padding to make sure all the signal will be processed.
      padding_elements = torch.zeros(
          clean_wavs.shape[0],
          hparams["chunk_size"],
          device=clean_wavs.device,
      )
      clean_wavs = torch.cat([clean_wavs, padding_elements], dim=1)
      noisy_wavs = torch.cat([noisy_wavs, padding_elements], dim=1)
  
      # Split sentences in smaller chunks
      noisy_wavs = create_chunks(
          noisy_wavs,
          chunk_size=hparams["chunk_size"],
          chunk_stride=hparams["chunk_size"],
      )
      clean_wavs = create_chunks(
          clean_wavs,
          chunk_size=hparams["chunk_size"],
          chunk_stride=hparams["chunk_size"],
      )
  
      # Perform speech enhancement with the current model
      out_d1 = self.compute_forward_d(noisy_wavs, clean_wavs)
      loss_d1 = self.compute_objectives_d1(out_d1, batch)
  
      z_mean = None
      z_logvar = None
      if self.modules["model_g"].latent_vae:
          out_g2, z_mean, z_logvar = self.compute_forward_g(noisy_wavs)
      else:
          out_g2 = self.compute_forward_g(noisy_wavs)
      out_d2 = self.compute_forward_d(out_g2, clean_wavs)
      loss_d2 = self.compute_objectives_d2(out_d2, batch)
  
      loss_g3 = self.compute_objectives_g3(
          out_d2,
          out_g2,
          clean_wavs,
          batch,
          stage=stage,
          z_mean=z_mean,
          z_logvar=z_logvar,
      )
  
      loss_d1.detach().cpu()
      loss_d2.detach().cpu()
      loss_g3.detach().cpu()
  
      return loss_d1 + loss_d2 + loss_g3
  
imports: import os
  import sys
  import torch
  import torchaudio
  import speechbrain
  from pesq import pesq
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.metric_stats import MetricStats
  from speechbrain.nnet.loss.stoi_loss import stoi_loss
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 7 for calling the SEBrain obj's underlying member method code with example usage: obj.evaluate_batch(batch, stage) and returns: unknown