code: def test_exception_2d(self):
      with pytest.raises(ValueError) as errinf:
          kornia.losses.HausdorffERLoss()(
              (torch.rand(1, 2, 1) > 0.5) * 1,
              (torch.rand(1, 1, 1, 2) > 0.5) * 1,
          )
      assert "Only 2D images supported. Got " in str(errinf)
  
      with pytest.raises(ValueError) as errinf:
          kornia.losses.HausdorffERLoss()(
              (torch.rand(1, 2, 1, 1) > 0.5) * 1,
              torch.tensor([[[[1]]]], dtype=torch.float32),
          )
      assert "Expect long type target value in range" in str(errinf)
  
      with pytest.raises(ValueError) as errinf:
          kornia.losses.HausdorffERLoss()(
              (torch.rand(1, 2, 1, 1) > 0.5) * 1,
              (torch.rand(1, 1, 1, 2) > 0.5) * 1,
          )
      assert (
          "Prediction and target need to be of same size, and target should not be one-hot."
          in str(errinf)
      )
  
file_path: kornia/test/losses/test_hd.py
imports: import pytest
  import torch
  from torch.autograd import gradcheck
  import kornia
  import kornia.testing
  from kornia.testing import assert_close
label_desc: Use image node_id 2 for calling the TestHausdorffLoss obj's underlying member method code with example usage: obj.test_exception_2d() without return types