class_docstr: Class for sound class embedding training"
      
class_docstr_tok: ["Class","for","sound","class","embedding","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
  
      # Add waveform augmentation if specified.
      if stage == sb.Stage.TRAIN and hasattr(
          self.hparams, "wav_augment"
      ):
          wavs, lens = self.hparams.wav_augment(wavs, lens)
  
      # Feature extraction and normalization
      feats = self.modules.compute_features(wavs)
  
      if self.hparams.amp_to_db:
          Amp2db = torchaudio.transforms.AmplitudeToDB(
              stype="power", top_db=80
          )  # try "magnitude" Vs "power"? db= 80, 50...
          feats = Amp2db(feats)
  
      # Normalization
      if self.hparams.normalize:
          feats = self.modules.mean_var_norm(feats, lens)
  
      # Embeddings + sound classifier
      embeddings = self.modules.embedding_model(feats)
      outputs = self.modules.classifier(embeddings)
  
      return outputs, lens
  
file_path: speechbrain/recipes/UrbanSound8k/SoundClassification/train.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 urbansound8k_prepare import prepare_urban_sound_8k
  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 UrbanSound8kBrain obj's underlying member method code with example usage: obj.compute_forward(batch, stage) and returns: outputs,  lens