code: def _sewar_rase(preds, target, window_size):
      """Baseline implementation of metric.
  
      This custom implementation is necessary since sewar only supports single image and aggregation therefore needs
      adjustments.
  
      """
      target_sum = torch.sum(
          _uniform_filter(target, window_size) / (window_size**2),
          dim=0,
      )
      target_mean = target_sum / target.shape[0]
      target_mean = target_mean.mean(0)  # mean over image channels
  
      preds = preds.permute(0, 2, 3, 1).numpy()
      target = target.permute(0, 2, 3, 1).numpy()
  
      rmse_mean = torch.zeros(*preds.shape[1:])
      for pred, tgt in zip(preds, target):
          _, rmse_map = sewar.rmse_sw(tgt, pred, window_size)
          rmse_mean += rmse_map
      rmse_mean /= preds.shape[0]
  
      rase_map = (
          100 / target_mean * torch.sqrt(torch.mean(rmse_mean**2, 2))
      )
      crop_slide = round(window_size / 2)
  
      return torch.mean(
          rase_map[crop_slide:-crop_slide, crop_slide:-crop_slide]
      )
  
file_path: torchmetrics/tests/unittests/image/test_rase.py
imports: from functools import partial
  from typing import NamedTuple
  import pytest
  import sewar
  import torch
  from torch import Tensor
  from torchmetrics.functional import relative_average_spectral_error
  from torchmetrics.functional.image.helper import _uniform_filter
  from torchmetrics.image import RelativeAverageSpectralError
  from unittests import BATCH_SIZE
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _sewar_rase(preds, target, window_size) and returns: torch