code: def test_ignored_out_of_num_classes_indices():
      num_classes = 21
      cm = ConfusionMatrix(num_classes=num_classes)
  
      y_pred = torch.rand(4, num_classes, 12, 10)
      y = torch.randint(0, 255, size=(4, 12, 10)).long()
      cm.update((y_pred, y))
      np_y_pred = y_pred.numpy().argmax(axis=1).ravel()
      np_y = y.numpy().ravel()
      assert np.all(
          confusion_matrix(
              np_y, np_y_pred, labels=list(range(num_classes))
          )
          == cm.compute().numpy()
      )
  
imports: import os
  import numpy
  import pytest
  import torch
  from sklearn.metrics import accuracy_score, confusion_matrix, precision_score, recall_score
  import ignite.distributed
  from ignite.exceptions import NotComputableError
  from ignite.metrics import ConfusionMatrix, IoU, JaccardIndex, mIoU
  from ignite.metrics.confusion_matrix import cmAccuracy, cmPrecision, cmRecall, DiceCoefficient
label_desc: Use image node_id 6 for calling a global function with example usage: test_ignored_out_of_num_classes_indices() without return types