code: def test_multiclass_input(n_times, test_data):
      y_pred, y, num_classes, batch_size = test_data
      cm = ConfusionMatrix(num_classes=num_classes)
      cm.reset()
      if batch_size > 1:
          n_iters = y.shape[0] // batch_size + 1
          for i in range(n_iters):
              idx = i * batch_size
              cm.update(
                  (
                      y_pred[idx : idx + batch_size],
                      y[idx : idx + batch_size],
                  )
              )
      else:
          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 5 for calling a global function with example usage: test_multiclass_input(n_times, test_data) without return types