code: def test_d_lambda_invalid_inputs(preds, target, p, match):
      """Test that invalid input raises the correct errors."""
      preds_t = torch.rand(preds)
      target_t = torch.rand(target)
      with pytest.raises(ValueError, match=match):
          spectral_distortion_index(preds_t, target_t, p)
  
imports: from functools import partial
  from typing import NamedTuple
  import numpy
  import pytest
  import torch
  from torch import Tensor
  from torchmetrics.functional.image.d_lambda import spectral_distortion_index
  from torchmetrics.functional.image.uqi import universal_image_quality_index
  from torchmetrics.image.d_lambda import SpectralDistortionIndex
  from unittests import BATCH_SIZE, NUM_BATCHES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling a global function with example usage: test_d_lambda_invalid_inputs(preds, target, p, match) without return types