class_docstr: Class for sound class embedding training" 
docstr: Computes the loss using class-id as label.
docstr_tok: ["Computes","the","loss","using","class-id","as","label","."]
code: def compute_objectives(self, pred, batch, stage):
      """Computes the loss using class-id as label."""
      (
          (reconstructions, time_activations),
          (classification_out, theta_out),
      ) = pred
  
      uttid = batch.id
      classid, _ = batch.class_string_encoded
  
      batch = batch.to(self.device)
      wavs, lens = batch.sig
  
      X_stft = self.modules.compute_stft(wavs).to(self.device)
      X_stft_power = sb.processing.features.spectral_magnitude(
          X_stft, power=self.hparams.spec_mag_power
      )
      X_stft_logpower = torch.log1p(X_stft_power)
  
      # Concatenate labels (due to data augmentation)
      if stage == sb.Stage.VALID or stage == sb.Stage.TEST:
          self.top_3_fidelity.append(
              batch.id, theta_out, classification_out
          )
          self.input_fidelity.append(batch.id, wavs, classification_out)
          self.faithfulness.append(batch.id, wavs, classification_out)
      self.acc_metric.append(
          uttid, predict=classification_out, target=classid, length=lens
      )
  
      X_stft_logpower = X_stft_logpower[
          :, : reconstructions.shape[1], :
      ]
  
      loss_nmf = ((reconstructions - X_stft_logpower) ** 2).mean()
      loss_nmf = self.hparams.alpha * loss_nmf
      loss_nmf += self.hparams.beta * (time_activations).abs().mean()
  
      if stage != sb.Stage.TEST:
          if hasattr(self.hparams.lr_annealing, "on_batch_end"):
              self.hparams.lr_annealing.on_batch_end(self.optimizer)
  
      self.last_batch = batch
      self.batch_to_plot = (
          reconstructions.clone(),
          X_stft_logpower.clone(),
      )
  
      theta_out = -torch.log(theta_out)
      loss_fdi = (
          F.softmax(classification_out, dim=1) * theta_out
      ).mean()
  
      return loss_nmf + loss_fdi
  
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 speechbrain.utils.metric_stats import MetricStats
  from os import makedirs
  import torch.nn.functional
  from speechbrain.processing.NMF import spectral_phase
label_desc: Use image node_id 5 for calling the InterpreterESC50Brain obj's underlying member method code with example usage: obj.compute_objectives(pred, batch, stage) and returns: unknown