code: def test_precision_recall_curve():
      size = 100
      np_y_pred = np.random.rand(size, 1)
      np_y = np.zeros((size,))
      np_y[size // 2 :] = 1
      sk_precision, sk_recall, sk_thresholds = precision_recall_curve(
          np_y, np_y_pred
      )
  
      precision_recall_curve_metric = PrecisionRecallCurve()
      y_pred = torch.from_numpy(np_y_pred)
      y = torch.from_numpy(np_y)
  
      precision_recall_curve_metric.update((y_pred, y))
      (
          precision,
          recall,
          thresholds,
      ) = precision_recall_curve_metric.compute()
      precision = precision.numpy()
      recall = recall.numpy()
      thresholds = thresholds.numpy()
  
      assert pytest.approx(precision) == sk_precision
      assert pytest.approx(recall) == sk_recall
      # assert thresholds almost equal, due to numpy->torch->numpy conversion
      np.testing.assert_array_almost_equal(thresholds, sk_thresholds)
  
imports: import os
  from typing import Tuple
  from unittest.mock import patch
  import numpy
  import pytest
  import sklearn
  import torch
  from sklearn.metrics import precision_recall_curve
  import ignite.distributed
  from ignite.contrib.metrics.precision_recall_curve import PrecisionRecallCurve
  from ignite.engine import Engine
  from ignite.metrics.epoch_metric import EpochMetricWarning
label_desc: Use image node_id 3 for calling a global function with example usage: test_precision_recall_curve() without return types