class_docstr: Class for classifier training"
      
class_docstr_tok: ["Class","for","classifier","training","''"]
docstr: Computation pipeline based on a encoder + sound classifier.
  Data augmentation and environmental corruption are applied to the
  input sound.
docstr_tok: ["Computation","pipeline","based","on","a","encoder","+","sound","classifier",".","Data","augmentation","and","environmental","corruption","are","applied","to","the","input","sound","."]
code: def compute_forward(self, batch, stage):
      """Computation pipeline based on a encoder + sound classifier.
      Data augmentation and environmental corruption are applied to the
      input sound.
      """
      batch = batch.to(self.device)
      wavs, lens = batch.sig
      X_stft = self.modules.compute_stft(wavs)
      X_stft_power = sb.processing.features.spectral_magnitude(
          X_stft, power=self.hparams.spec_mag_power
      )
  
      if self.hparams.use_melspectra:
          net_input = self.modules.compute_fbank(X_stft_power)
      else:
          net_input = torch.log1p(X_stft_power)
  
      # Embeddings + sound classifier
      embeddings = self.modules.embedding_model(net_input)
      if embeddings.ndim == 4:
          embeddings = embeddings.mean((-1, -2))
  
      outputs = self.modules.classifier(embeddings)
  
      return outputs, lens
  
file_path: speechbrain/recipes/ESC50/classification/train_classifier.py
imports: import os
  import sys
  import torch
  import torchaudio
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main
  from esc50_prepare import prepare_esc50
  from sklearn.metrics import confusion_matrix
  import numpy
  from confusion_matrix_fig import create_cm_fig
label_desc: Use image node_id 1 for calling the ESC50Brain obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: outputs,  lens