code: def test_roc_curve():
      size = 100
      np_y_pred = np.random.rand(size, 1)
      np_y = np.zeros((size,))
      np_y[size // 2 :] = 1
      sk_fpr, sk_tpr, sk_thresholds = roc_curve(np_y, np_y_pred)
  
      roc_curve_metric = RocCurve()
      y_pred = torch.from_numpy(np_y_pred)
      y = torch.from_numpy(np_y)
  
      roc_curve_metric.update((y_pred, y))
      fpr, tpr, thresholds = roc_curve_metric.compute()
  
      assert np.array_equal(fpr, sk_fpr)
      assert np.array_equal(tpr, sk_tpr)
      # assert thresholds almost equal, due to numpy->torch->numpy conversion
      np.testing.assert_array_almost_equal(thresholds, sk_thresholds)
  
file_path: ignite/tests/ignite/contrib/metrics/test_roc_curve.py
imports: from unittest.mock import patch
  import numpy
  import pytest
  import sklearn
  import torch
  from sklearn.metrics import roc_curve
  from ignite import distributed
  from ignite.contrib.metrics.roc_auc import RocCurve
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
  from ignite.metrics.epoch_metric import EpochMetricWarning
label_desc: Use image node_id 4 for calling a global function with example usage: test_roc_curve() without return types