docstr: Computes the loss given predictions and targets.
docstr_tok: ["Computes","the","loss","given","predictions","and","targets","."]
code: def compute_objectives(self, predictions, batch, stage):
      """Computes the loss given predictions and targets."""
      batch = batch.to(self.device)
      tokens_eos, tokens_len = batch.tokens_eos
      loss = self.hparams.compute_cost(
          predictions, tokens_eos, length=tokens_len
      )
      return loss
  
file_path: speechbrain/recipes/KsponSpeech/LM/train.py
imports: import sys
  import logging
  from pathlib import Path
  import torch
  from hyperpyyaml import load_hyperpyyaml
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 2 for calling the LM obj's underlying member method code with example usage: obj.compute_objectives(predictions, batch, stage) and returns: loss