code: def test_exception():
      serial = SegmentationLabelsOutput()
  
      with pytest.raises(Exception):
          sample = torch.zeros(1, 5, 2, 3)
          serial.transform(sample)
  
      with pytest.raises(Exception):
          sample = torch.zeros(2, 3)
          serial.transform(sample)
  
file_path: lightning-flash/tests/image/semantic_segm/test_output.py
imports: import pytest
  import torch
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _SEGMENTATION_MODELS_AVAILABLE, _TOPIC_IMAGE_AVAILABLE, _TOPIC_SERVE_AVAILABLE
  from flash.image.segmentation.output import FiftyOneSegmentationLabelsOutput, SegmentationLabelsOutput
label_desc: Use image node_id 2 for calling the TestSemanticSegmentationLabelsOutput obj's underlying member method code with example usage: obj.test_exception() without return types