docstr: Validates the loss functions, loss weights, training labels and prediction labels.
  
  Parameters
  ---------
  y_pred
      Prediction labels.
  y_true
      True labels.
docstr_tok: ["Validates","the","loss","functions",",","loss","weights",",","training","labels","and","prediction","labels",".","Parameters","--","--","--","--","-","y_pred","Prediction","labels",".","y_true","True","labels","."]
code: def validate_prediction_labels(
      self,
      y_pred: Union[torch.Tensor, List[torch.Tensor]],
      y_true: Union[torch.Tensor, List[torch.Tensor]],
  ):
      """
      Validates the loss functions, loss weights, training labels and prediction labels.
  
      Parameters
      ---------
      y_pred
          Prediction labels.
      y_true
          True labels.
      """
      if isinstance(self.loss, list):
          # check that prediction is a list
          if not isinstance(y_pred, list):
              raise ValueError(
                  "The prediction should be a list since list of losses have been passed."
              )
  
          # check that the labels is a list
          if not isinstance(y_true, list):
              raise ValueError(
                  "The label should be a list since list of losses have been passed."
              )
  
          # check if the number of predictions matches the number of labels
          if len(y_true) != len(y_pred):
              raise ValueError(
                  "Number of predictions differs from the number of labels."
              )
  
          # check if the number of output heads matches the number of output losses
          if len(y_pred) != len(self.loss):
              raise ValueError(
                  "Number of model's heads differs from the number of losses."
              )
  
          # TODO: remove this case since is already considered
          if len(self.loss_weights) != 0 and (
              len(self.loss_weights) != len(self.loss)
          ):
              raise ValueError(
                  "Number of loss weights should be equal to the number of losses."
              )
      else:
          # check that the prediction is not a list
          if isinstance(y_pred, list):
              raise ValueError(
                  "The prediction is a list and should be a tensor since only one loss has been passed"
              )
  
          # check that the label is not a list
          if isinstance(y_true, list):
              raise ValueError(
                  "The label is a list and should be a tensor since only one loss has been passed"
              )
  
      # check if metrics and predictions agree
      if (
          (len(self.metrics) > 0)
          and (not isinstance(self.metrics, dict))
          and isinstance(y_pred, list)
      ):
          raise ValueError(
              "Multiple model's head require dictionary of metrics."
          )
  
imports: import torch
  import torch.nn
  import torch.optim
  from torch.utils.data import DataLoader
  from tqdm import tqdm
  from typing import List, Dict, Callable, Union, Tuple, Optional
  from alibi.models.pytorch.metrics import Metric, LossContainer
label_desc: Use image node_id 3 for calling the Model obj's underlying member method code with example usage: obj.validate_prediction_labels(y_pred, y_true) without return types