code: def _sewar_rmse_sw(preds, target, window_size):
      rmse_mean = torch.tensor(0.0, dtype=preds.dtype)
  
      preds = preds.permute(0, 2, 3, 1).numpy()
      target = target.permute(0, 2, 3, 1).numpy()
  
      for idx, (pred, tgt) in enumerate(zip(preds, target)):
          rmse, _ = sewar.rmse_sw(tgt, pred, window_size)
          rmse_mean += (rmse - rmse_mean) / (idx + 1)
  
      return rmse_mean
  
file_path: torchmetrics/tests/unittests/image/test_rmse_sw.py
imports: from functools import partial
  from typing import NamedTuple
  import pytest
  import sewar
  import torch
  from torch import Tensor
  from torchmetrics.functional import root_mean_squared_error_using_sliding_window
  from torchmetrics.image import RootMeanSquaredErrorUsingSlidingWindow
  from unittests import BATCH_SIZE, NUM_BATCHES
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _sewar_rmse_sw(preds, target, window_size) and returns: rmse_mean