code: def test_polygon_iou(rbox1, rbox2, iou, abs_tol):
      mask_shape = (256, 256)
      iou_mat = metrics.polygon_iou(
          np.asarray(rbox1), np.asarray(rbox2), mask_shape
      )
      assert iou_mat.shape == (len(rbox1), len(rbox2))
      if iou_mat.size > 0:
          assert abs(iou_mat - iou) <= abs_tol
  
      # Ensure broadcasting doesn't change the result
      iou_matbis = metrics.polygon_iou(
          np.asarray(rbox1),
          np.asarray(rbox2),
          mask_shape,
          use_broadcasting=False,
      )
      assert np.all((iou_mat - iou_matbis) <= 1e-7)
  
      # Incorrect boxes
      with pytest.raises(AssertionError):
          metrics.polygon_iou(
              np.zeros((2, 5), dtype=float),
              np.ones((3, 4), dtype=float),
              mask_shape,
          )
  
file_path: doctr/tests/common/test_utils_metrics.py
imports: import numpy
  import pytest
  from doctr.utils import metrics
label_desc: Use image node_id 4 for calling a global function with example usage: test_polygon_iou(rbox1, rbox2, iou, abs_tol) without return types