class_docstr: Sets up a standard trainer
  
  Args:
      device: gpu or cpu
      train_loader: the training data loader
      valid_loader: the validation data loader
      model: the (network) model
      optim: the optimizer
      logger:: the logger to log info
      output_dir: the path to save info
      cfg: a YACS config object.
class_docstr_tok: ["Sets","up","a","standard","trainer","Args",":","device",":","gpu","or","cpu","train_loader",":","the","training","data","loader","valid_loader",":","the","validation","data","loader","model",":","the","(","network",")","model","optim",":","the","optimizer","logger",":",":","the","logger","to","log","info","output_dir",":","the","path","to","save","info","cfg",":","a","YACS","config","object","."]
docstr: Computes the loss between learning outputs and the targets (ground truth)
docstr_tok: ["Computes","the","loss","between","learning","outputs","and","the","targets","(","ground","truth",")"]
code: def loss(self, outputs, targets):
      """Computes the loss between learning outputs and the targets (ground truth)"""
      loss = self.criterion(outputs, targets)
      self.ce_loss += loss.item()
  
      if self.cfg.ISON.ORTHO_COEFF > 0:
          o_loss = self.model.module.ortho(self.device)
          self.ortho_loss += o_loss.item()
          loss += o_loss * self.cfg.ISON.ORTHO_COEFF
      return loss
  
file_path: pykale/examples/cifar_isonet/trainer.py
imports: import time
  import torch
  import torch.nn
  from kale.utils.print import pprint_without_newline, tprint
label_desc: Use image node_id 5 for calling the Trainer obj's underlying member method code with example usage: obj.loss(outputs, targets) and returns: loss