original_docstring: 
          Calculates the AUC score given the predictions and targets.
  
          Args:
              pred: prediction (Torch tensor).
              targets: target varialbles (Torch tensor).
          
docstring: Calculates the AUC score given the predictions and targets.
docstring_tokens: Calculates the AUC score given the predictions and targets .
code: def calc_auc(self, pred, targets):
          """
          Calculates the AUC score given the predictions and targets.
  
          Args:
              pred: prediction (Torch tensor).
              targets: target varialbles (Torch tensor).
          """
          try:
              auc = roc_auc_score(targets.cpu().detach().numpy(), pred.cpu().detach().numpy())
  
          except ValueError:
              # AUC can only be calculated if there are FP, FN, TP and TN
              # TODO: How does tensorflow handle this?
              print("Your data is too unbalanced to calculate AUC")
              auc = 0
          return auc
code_tokens: def calc_auc ( self , pred , targets ) : try : auc = roc_auc_score ( targets . cpu ( ) . detach ( ) . numpy ( ) , pred . cpu ( ) . detach ( ) . numpy ( ) ) except ValueError : print ( "Your data is too unbalanced to calculate AUC" ) auc = 0 return auc
short_docstring: Calculates the AUC score given the predictions and targets.
short_docstring_tokens: Calculates the AUC score given the predictions and targets .
comment: """
          Calculates the AUC score given the predictions and targets.
  
          Args:
              pred: prediction (Torch tensor).
              targets: target varialbles (Torch tensor).
          """$SEP$# AUC can only be calculated if there are FP, FN, TP and TN$SEP$# TODO: How does tensorflow handle this?