code: def test_auc_with_mask(self, device: str):
      auc = Auc()
  
      predictions = torch.randn(8, device=device)
      labels = torch.randint(
          0, 2, (8,), dtype=torch.long, device=device
      )
      mask = torch.tensor(
          [True, True, True, True, False, False, False, False],
          device=device,
      )
  
      auc(predictions, labels, mask)
      computed_auc_value = auc.get_metric(reset=True)
  
      false_positive_rates, true_positive_rates, _ = metrics.roc_curve(
          labels[:4].cpu().numpy(), predictions[:4].cpu().numpy()
      )
      real_auc_value = metrics.auc(
          false_positive_rates, true_positive_rates
      )
      assert_allclose(real_auc_value, computed_auc_value)
  
file_path: allennlp/tests/training/metrics/auc_test.py
imports: import pytest
  import torch
  from sklearn import metrics
  from torch.testing import assert_allclose
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase, multi_device, global_distributed_metric, run_distributed_test
  from allennlp.training.metrics import Auc
label_desc: Use image node_id 3 for calling the AucTest obj's underlying member method code with example usage: obj.test_auc_with_mask(device) without return types