class_docstr: Computes Root Mean Squared Error (RMSE) using sliding window.
  
  As input to ``forward`` and ``update`` the metric accepts the following input
  
  - ``preds`` (:class:`~torch.Tensor`): Predictions from model of shape ``(N,C,H,W)``
  - ``target`` (:class:`~torch.Tensor`): Ground truth values of shape ``(N,C,H,W)``
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``rmse_sw`` (:class:`~torch.Tensor`): returns float scalar tensor with average RMSE-SW value over sample
  
  Args:
      window_size: Sliding window used for rmse calculation
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Example:
      >>> from torchmetrics.image import RootMeanSquaredErrorUsingSlidingWindow
      >>> g = torch.manual_seed(22)
      >>> preds = torch.rand(4, 3, 16, 16)
      >>> target = torch.rand(4, 3, 16, 16)
      >>> rmse_sw = RootMeanSquaredErrorUsingSlidingWindow()
      >>> rmse_sw(preds, target)
      tensor(0.3999)
  
  Raises:
      ValueError: If ``window_size`` is not a positive integer.
class_docstr_tok: ["Computes","Root","Mean","Squared","Error","(","RMSE",")","using","sliding","window",".","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input","-","``","preds","``","(",":","class",":","`","~torch.Tensor","`",")",":","Predictions","from","model","of","shape","``","(","N",",","C",",","H",",","W",")","``","-","``","target","``","(",":","class",":","`","~torch.Tensor","`",")",":","Ground","truth","values","of","shape","``","(","N",",","C",",","H",",","W",")","``","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","rmse_sw","``","(",":","class",":","`","~torch.Tensor","`",")",":","returns","float","scalar","tensor","with","average","RMSE-SW","value","over","sample","Args",":","window_size",":","Sliding","window","used","for","rmse","calculation","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Example",":",">",">",">","from","torchmetrics.image","import","RootMeanSquaredErrorUsingSlidingWindow",">",">",">","g","=","torch.manual_seed","(","22",")",">",">",">","preds","=","torch.rand","(","4",",","3",",","16",",","16",")",">",">",">","target","=","torch.rand","(","4",",","3",",","16",",","16",")",">",">",">","rmse_sw","=","RootMeanSquaredErrorUsingSlidingWindow","(",")",">",">",">","rmse_sw","(","preds",",","target",")","tensor","(","0.3999",")","Raises",":","ValueError",":","If","``","window_size","``","is","not","a","positive","integer","."]
code: def __init__(
      self,
      window_size: int = 8,
      **kwargs: Dict[str, Any],
  ) -> None:
      super().__init__(**kwargs)
      if (
          not isinstance(window_size, int)
          or isinstance(window_size, int)
          and window_size < 1
      ):
          raise ValueError(
              "Argument `window_size` is expected to be a positive integer."
          )
      self.window_size = window_size
  
      self.add_state(
          "rmse_val_sum",
          default=torch.tensor(0.0),
          dist_reduce_fx="sum",
      )
      self.add_state(
          "total_images",
          default=torch.tensor(0.0),
          dist_reduce_fx="sum",
      )
  
file_path: torchmetrics/src/torchmetrics/image/rmse_sw.py
imports: from typing import Any, Dict, Optional, Sequence, Union
  import torch
  from torch import Tensor
  from torchmetrics.functional.image.rmse_sw import _rmse_sw_compute, _rmse_sw_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 1 to create a new RootMeanSquaredErrorUsingSlidingWindow object from inherited base classes: Metric with example: obj = RootMeanSquaredErrorUsingSlidingWindow(window_size)