code: def test_error_on_invalid_shape(
      metric_class=ErrorRelativeGlobalDimensionlessSynthesis,
  ):
      """Check that error is raised when input is not 4D."""
      metric = metric_class()
      with pytest.raises(
          ValueError,
          match="Expected `preds` and `target` to have BxCxHxW shape.*",
      ):
          metric(torch.randn([3, 16, 16]), torch.randn([3, 16, 16]))
  
imports: from functools import partial
  from typing import NamedTuple
  import pytest
  import torch
  from torch import Tensor
  from torchmetrics.functional.image.ergas import error_relative_global_dimensionless_synthesis
  from torchmetrics.image.ergas import ErrorRelativeGlobalDimensionlessSynthesis
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  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_error_on_invalid_shape(metric_class) without return types