docstr: Computes the loss according to network output and targets
  
  Parameters
  ----------
  y_pred : list of tensors
      Output of network
  y_true : LongTensor
      Targets label encoded
  
  Returns
  -------
  loss : torch.Tensor
      output of loss function(s)
docstr_tok: ["Computes","the","loss","according","to","network","output","and","targets","Parameters","--","--","--","--","--","y_pred",":","list","of","tensors","Output","of","network","y_true",":","LongTensor","Targets","label","encoded","Returns","--","--","--","-","loss",":","torch.Tensor","output","of","loss","function","(","s",")"]
code: def compute_loss(self, y_pred, y_true):
      """
      Computes the loss according to network output and targets
  
      Parameters
      ----------
      y_pred : list of tensors
          Output of network
      y_true : LongTensor
          Targets label encoded
  
      Returns
      -------
      loss : torch.Tensor
          output of loss function(s)
  
      """
      loss = 0
      y_true = y_true.long()
      if isinstance(self.loss_fn, list):
          # if you specify a different loss for each task
          for task_loss, task_output, task_id in zip(
              self.loss_fn, y_pred, range(len(self.loss_fn))
          ):
              loss += task_loss(task_output, y_true[:, task_id])
      else:
          # same loss function is applied to all tasks
          for task_id, task_output in enumerate(y_pred):
              loss += self.loss_fn(task_output, y_true[:, task_id])
  
      loss /= len(y_pred)
      return loss
  
file_path: tabnet/pytorch_tabnet/multitask.py
imports: import torch
  import numpy
  from scipy.special import softmax
  from pytorch_tabnet.utils import SparsePredictDataset, PredictDataset, filter_weights
  from pytorch_tabnet.abstract_model import TabModel
  from pytorch_tabnet.multiclass_utils import infer_multitask_output, check_output_dim
  from torch.utils.data import DataLoader
  import scipy
label_desc: Use image node_id 3 for calling the TabNetMultiTaskClassifier obj's underlying member method code with example usage: obj.compute_loss(y_pred, y_true) and returns: loss