code: def test_binned_aupro(labels, preds, threshold_count):
      aupro = AUPRO()
      computed_not_binned_aupro = aupro(preds, labels)
  
      binned_pro = AUPRO(num_thresholds=threshold_count)
      computed_binned_aupro = binned_pro(preds, labels)
  
      TOL = 0.001
      # with threshold binning the roc curve computed within the metric is more memory efficient
      # but a bit less accurate. So we check the difference in order to validate the binning effect.
      assert computed_binned_aupro != computed_not_binned_aupro
      assert torch.allclose(
          computed_not_binned_aupro, computed_binned_aupro, atol=TOL
      )
  
      # test with prediction higher than 1
      preds = preds * 2
      computed_binned_aupro = binned_pro(preds, labels)
      computed_not_binned_aupro = aupro(preds, labels)
  
      # with threshold binning the roc curve computed within the metric is more memory efficient
      # but a bit less accurate. So we check the difference in order to validate the binning effect.
      assert computed_binned_aupro != computed_not_binned_aupro
      assert torch.allclose(
          computed_not_binned_aupro, computed_binned_aupro, atol=TOL
      )
  
imports: import numpy
  import torch
  from anomalib.utils.metrics import AUPRO
  from tests.helpers.aupro_reference import calculate_au_pro
label_desc: Use image node_id 3 for calling a global function with example usage: test_binned_aupro(labels, preds, threshold_count) without return types