code: def test_linknet_postprocessor():
      postprocessor = LinkNetPostProcessor()
      r_postprocessor = LinkNetPostProcessor(
          assume_straight_pages=False
      )
      with pytest.raises(AssertionError):
          postprocessor(np.random.rand(2, 512, 512).astype(np.float32))
      mock_batch = np.random.rand(2, 512, 512, 1).astype(np.float32)
      out = postprocessor(mock_batch)
      r_out = r_postprocessor(mock_batch)
      # Batch composition
      assert isinstance(out, list)
      assert len(out) == 2
      assert all(
          isinstance(sample, list)
          and all(isinstance(v, np.ndarray) for v in sample)
          for sample in out
      )
      assert all(all(v.shape[1] == 5 for v in sample) for sample in out)
      assert all(
          all(v.shape[1] == 4 and v.shape[2] == 2 for v in sample)
          for sample in r_out
      )
      # Relative coords
      assert all(
          all(
              np.all(np.logical_and(v[:4] >= 0, v[:4] <= 1))
              for v in sample
          )
          for sample in out
      )
  
imports: import numpy
  import pytest
  from doctr.models.detection.differentiable_binarization.base import DBPostProcessor
  from doctr.models.detection.linknet.base import LinkNetPostProcessor
label_desc: Use image node_id 2 for calling a global function with example usage: test_linknet_postprocessor() without return types