code: def pr_curve_raw(
      tag,
      tp,
      fp,
      tn,
      fn,
      precision,
      recall,
      num_thresholds=127,
      weights=None,
  ):
      if num_thresholds > 127:  # weird, value > 127 breaks protobuf
          num_thresholds = 127
      data = np.stack((tp, fp, tn, fn, precision, recall))
      pr_curve_plugin_data = PrCurvePluginData(
          version=0, num_thresholds=num_thresholds
      ).SerializeToString()
      PluginData = SummaryMetadata.PluginData(
          plugin_name="pr_curves", content=pr_curve_plugin_data
      )
      smd = SummaryMetadata(plugin_data=PluginData)
      tensor = TensorProto(
          dtype="DT_FLOAT",
          float_val=data.reshape(-1).tolist(),
          tensor_shape=TensorShapeProto(
              dim=[
                  TensorShapeProto.Dim(size=data.shape[0]),
                  TensorShapeProto.Dim(size=data.shape[1]),
              ]
          ),
      )
      return Summary(
          value=[Summary.Value(tag=tag, metadata=smd, tensor=tensor)]
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import numpy
  import os
  import re
  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.plugin_text_pb2 import TextPluginData
  from .proto.plugin_mesh_pb2 import MeshPluginData
  from .proto import layout_pb2
  from .x2num import make_np
  from .utils import _prepare_video, convert_to_HWC, convert_to_NTCHW
label_desc: Use image node_id 17 for calling a global function with example usage: pr_curve_raw(tag, tp, fp, tn, fn, precision, recall, num_thresholds, weights) and returns: Summary