class_docstr: Test class for `SpectralAngleMapper` metric.
class_docstr_tok: ["Test","class","for","`","SpectralAngleMapper","`","metric","."]
docstr: Test functional implementation of metric.
docstr_tok: ["Test","functional","implementation","of","metric","."]
code: def test_sam_functional(self, reduction, preds, target):
      """Test functional implementation of metric."""
      self.run_functional_metric_test(
          preds,
          target,
          spectral_angle_mapper,
          partial(_baseline_sam, reduction=reduction),
          metric_args={"reduction": reduction},
      )
  
imports: from functools import partial
  import pytest
  import torch
  from torch import Tensor
  from torch.nn import functional
  from torchmetrics.functional.image.sam import spectral_angle_mapper
  from torchmetrics.image.sam import SpectralAngleMapper
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling the TestSpectralAngleMapper obj's underlying member method code with example usage: obj.test_sam_functional(reduction, preds, target) without return types