code: def confusion_matrix(y_pred: Tensor, y_true: Tensor, **kwargs):
      try:
          y_pred = np.argmax(y_pred.detach().cpu().numpy(), axis=1)
          return sklearn_confusion_matrix(
              y_true.detach().cpu().numpy(),
              y_pred,
              labels=kwargs.get("labels"),
          )
      except Exception as e:
          logger.error(e)
  
file_path: fast-bert/fast_bert/metrics.py
imports: import numpy
  from torch import Tensor
  from sklearn.metrics import roc_curve, auc, hamming_loss, accuracy_score, confusion_matrix
  import pdb
  import logging
label_desc: Use image node_id 9 for calling a global function with example usage: confusion_matrix(y_pred, y_true) and returns: sklearn_confusion_matrix