code: def test_multi_dim_input(self):
      y_pred = np.array([[0, 1], [0, 1]], dtype=np.float32)
      y_true = np.array([[0, 0], [1, 1]])
      sample_weight = np.array([[0.2, 0.3], [0.4, 0.1]])
  
      obj = metrics.IoU(num_classes=2, target_class_ids=[0, 1])
  
      result = obj(y_true, y_pred, sample_weight=sample_weight)
  
      # cm = [[0.2, 0.3],
      #       [0.4, 0.1]]
      # sum_row = [0.6, 0.4], sum_col = [0.5, 0.5], true_positives = [0.2,
      # 0.1]
      # iou = true_positives / (sum_row + sum_col - true_positives))
      expected_result = (
          0.2 / (0.6 + 0.5 - 0.2) + 0.1 / (0.4 + 0.5 - 0.1)
      ) / 2
      self.assertAllClose(result, expected_result, atol=1e-3)
  
imports: import numpy
  import pytest
  from keras import layers
  from keras import models
  from keras import testing
  from keras.metrics import iou_metrics
label_desc: Use image node_id 4 for calling the IoUTest obj's underlying member method code with example usage: obj.test_multi_dim_input() without return types