code: def calc_auc(pos_logits, neg_logits):
      """calc_auc"""
      pos_logits = paddle.reshape(pos_logits[:, 0], [-1, 1])
      neg_logits = paddle.reshape(neg_logits[:, 0], [-1, 1])
      proba = paddle.concat([pos_logits, neg_logits], 0)
      proba = paddle.concat([proba * -1 + 1, proba], axis=1)
  
      pos_labels = paddle.ones_like(pos_logits)
      neg_labels = paddle.zeros_like(neg_logits)
  
      pos_labels = paddle.cast(pos_labels, dtype="int64")
      neg_labels = paddle.cast(neg_labels, dtype="int64")
  
      labels = paddle.concat([pos_labels, neg_labels], 0)
      labels.stop_gradient = True
      _, batch_auc_out, state_tuple = static.auc(
          input=proba, label=labels, num_thresholds=4096
      )
      return batch_auc_out, state_tuple
  
imports: import os
  import sys
  import math
  import time
  import numpy
  import pickle
  import paddle
  import paddle.fluid
  import paddle.fluid.layers
  import paddle.static
  from paddle.common_ops_import import LayerHelper, check_type, check_variable_and_dtype
  from paddle.fluid.framework import Variable
  import pgl
  from pgl.utils.logger import log
label_desc: Use image node_id 2 for calling a global function with example usage: calc_auc(pos_logits, neg_logits) and returns: batch_auc_out,  state_tuple