code: def test_input_types():
      ap = AveragePrecision()
      ap.reset()
      output1 = (
          torch.rand(4, 3),
          torch.randint(0, 2, size=(4, 3), dtype=torch.long),
      )
      ap.update(output1)
  
      with pytest.raises(
          ValueError,
          match=r"Incoherent types between input y_pred and stored predictions",
      ):
          ap.update(
              (
                  torch.randint(0, 5, size=(4, 3)),
                  torch.randint(0, 2, size=(4, 3)),
              )
          )
  
      with pytest.raises(
          ValueError,
          match=r"Incoherent types between input y and stored targets",
      ):
          ap.update(
              (
                  torch.rand(4, 3),
                  torch.randint(0, 2, size=(4, 3)).to(torch.int32),
              )
          )
  
      with pytest.raises(
          ValueError,
          match=r"Incoherent types between input y_pred and stored predictions",
      ):
          ap.update(
              (
                  torch.randint(0, 2, size=(10,)).long(),
                  torch.randint(0, 2, size=(10, 5)).long(),
              )
          )
  
imports: import os
  from unittest.mock import patch
  import pytest
  import sklearn
  import torch
  from sklearn.metrics import average_precision_score
  import ignite.distributed
  from ignite.contrib.metrics import AveragePrecision
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
label_desc: Use image node_id 4 for calling a global function with example usage: test_input_types() without return types