code: def _compute_curve(labels, predictions, num_thresholds, weights=None):
      """This function is another implementation of functions in
      https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/pr_curve/summary.py
      """
  
      if weights is None:
          weights = 1.0
  
      # Compute bins of true positives and false positives.
      bucket_indices = np.int32(
          np.floor(predictions * (num_thresholds - 1))
      )
      float_labels = labels.astype(np.float)
      histogram_range = (0, num_thresholds - 1)
      tp_buckets, _ = np.histogram(
          bucket_indices,
          bins=num_thresholds,
          range=histogram_range,
          weights=float_labels * weights,
      )
      fp_buckets, _ = np.histogram(
          bucket_indices,
          bins=num_thresholds,
          range=histogram_range,
          weights=(1.0 - float_labels) * weights,
      )
  
      # Obtain the reverse cumulative sum.
      tp = np.cumsum(tp_buckets[::-1])[::-1]
      fp = np.cumsum(fp_buckets[::-1])[::-1]
      tn = fp[0] - fp
      fn = tp[0] - tp
      precision = tp / np.maximum(_MINIMUM_COUNT, tp + fp)
      recall = tp / np.maximum(_MINIMUM_COUNT, tp + fn)
      return np.stack((tp, fp, tn, fn, precision, recall))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import io
  import wave
  import struct
  import json
  import re
  import numpy
  from mxnet.ndarray import NDArray
  from mxnet.symbol import Symbol
  from mxnet.gluon import HybridBlock
  from .proto.summary_pb2 import Summary
  from .proto.summary_pb2 import HistogramProto
  from .proto.summary_pb2 import SummaryMetadata
  from .proto.tensor_pb2 import TensorProto
  from .proto.tensor_shape_pb2 import TensorShapeProto
  from .proto.plugin_pr_curve_pb2 import PrCurvePluginData
  from .proto.node_def_pb2 import NodeDef
  from .proto.graph_pb2 import GraphDef
  from .proto.attr_value_pb2 import AttrValue
  from .proto.versions_pb2 import VersionDef
  from .utils import _make_numpy_array, _prepare_image
label_desc: Use image node_id 10 for calling a global function with example usage: _compute_curve(labels, predictions, num_thresholds, weights) and returns: np