code: def test_exception(self):
      prompter = VisualPrompter(SamConfig("vit_b"))
  
      inpt = torch.rand(1, 3, 1, 2)
  
      # Wrong shape for the image
      with pytest.raises(TypeError) as errinfo:
          prompter.set_image(inpt, [], False)
      assert (
          "shape must be [['3', 'H', 'W']]. Got torch.Size([1, 3, 1, 2])"
          in str(errinfo)
      )
  
      # predict without set an image
      with pytest.raises(Exception) as errinfo:
          prompter.predict()
      assert "An image must be set with `self.set_image(...)`" in str(
          errinfo
      )
  
      # Valid masks
      with pytest.raises(TypeError) as errinfo:
          prompter._valid_masks(inpt)
      assert (
          "shape must be [['K', '1', '256', '256']]. Got torch.Size([1, 3, 1, 2])"
          in str(errinfo)
      )
  
      # Valid boxes
      with pytest.raises(TypeError) as errinfo:
          prompter._valid_boxes(inpt)
      assert (
          "shape must be [['K', '4']]. Got torch.Size([1, 3, 1, 2])"
          in str(errinfo)
      )
  
      # Valid keypoints
      with pytest.raises(TypeError) as errinfo:
          prompter._valid_keypoints(inpt, None)
      assert (
          "shape must be [['K', 'N', '2']]. Got torch.Size([1, 3, 1, 2])"
          in str(errinfo)
      )
  
      with pytest.raises(TypeError) as errinfo:
          prompter._valid_keypoints(torch.rand(1, 1, 2), inpt)
      assert (
          "shape must be [['K', 'N']]. Got torch.Size([1, 3, 1, 2])"
          in str(errinfo)
      )
  
      with pytest.raises(Exception) as errinfo:
          prompter._valid_keypoints(
              torch.rand(1, 1, 2), torch.rand(2, 1)
          )
      assert (
          "The keypoints and labels should have the same batch size"
          in str(errinfo)
      )
  
file_path: kornia/test/contrib/test_prompter.py
imports: import pytest
  import torch
  from kornia.contrib.models.sam import SamConfig
  from kornia.contrib.visual_prompter import VisualPrompter
  from kornia.testing import BaseTester
label_desc: Use image node_id 3 for calling the TestVisualPrompter obj's underlying member method code with example usage: obj.test_exception() without return types