class_docstr: Splits the input into patches with sliding window strategy and a possible overlap.
  It also allows offsetting the starting position and filtering the patches.
  
  Args:
      patch_size : the size of the patches to be generated.
      offset: the amount of offset for the patches with respect to the original input.  Defaults to 0.
      overlap: the amount of overlap between patches in each dimension. It can be either a float in
          the range of [0.0, 1.0) that defines relative overlap to the patch size, or it can be a non-negative int
          that defines number of pixels for overlap. Defaults to 0.0.
      filter_fn: a callable to filter patches. It should accepts exactly two parameters (patch, location), and
          return True for a patch to keep. Defaults to no filtering.
      pad_mode: string define the mode for `torch.nn.functional.pad`. The acceptable values are
          `"constant"`, `"reflect"`, `"replicate"`, `"circular"` or `None`. Default to `"constant"`.
          If None, no padding will be applied, so it will drop the patches crossing the border of
          the image (either when the offset is negative or the image is non-divisible by the patch_size).
      pad_value: the value for `"constant"` padding. Defaults to 0.
      device: the device where the patches are generated. Defaults to the device of inputs.
  
  Note:
      When a scaler value is provided for `patch_size`, `offset`, or `overlap`,
          it is broadcasted to all the spatial dimensions.
class_docstr_tok: ["Splits","the","input","into","patches","with","sliding","window","strategy","and","a","possible","overlap",".","It","also","allows","offsetting","the","starting","position","and","filtering","the","patches",".","Args",":","patch_size",":","the","size","of","the","patches","to","be","generated",".","offset",":","the","amount","of","offset","for","the","patches","with","respect","to","the","original","input",".","Defaults","to","0.","overlap",":","the","amount","of","overlap","between","patches","in","each","dimension",".","It","can","be","either","a","float","in","the","range","of","[","0.0",",","1.0",")","that","defines","relative","overlap","to","the","patch","size",",","or","it","can","be","a","non-negative","int","that","defines","number","of","pixels","for","overlap",".","Defaults","to","0.0.","filter_fn",":","a","callable","to","filter","patches",".","It","should","accepts","exactly","two","parameters","(","patch",",","location",")",",","and","return","True","for","a","patch","to","keep",".","Defaults","to","no","filtering",".","pad_mode",":","string","define","the","mode","for","`","torch.nn.functional.pad","`",".","The","acceptable","values","are","`","``","constant","''","`",",","`","``","reflect","''","`",",","`","``","replicate","''","`",",","`","``","circular","''","`","or","`","None","`",".","Default","to","`","``","constant","''","`",".","If","None",",","no","padding","will","be","applied",",","so","it","will","drop","the","patches","crossing","the","border","of","the","image","(","either","when","the","offset","is","negative","or","the","image","is","non-divisible","by","the","patch_size",")",".","pad_value",":","the","value","for","`","``","constant","''","`","padding",".","Defaults","to","0.","device",":","the","device","where","the","patches","are","generated",".","Defaults","to","the","device","of","inputs",".","Note",":","When","a","scaler","value","is","provided","for","`","patch_size","`",",","`","offset","`",",","or","`","overlap","`",",","it","is","broadcasted","to","all","the","spatial","dimensions","."]
code: def _get_valid_shape_parameters(
      self, spatial_shape: Sequence[int]
  ) -> tuple[
      tuple[int, ...],
      tuple[float, ...] | tuple[int, ...],
      tuple[int, ...],
  ]:
      spatial_ndim = len(spatial_shape)
      # patch_size
      patch_size = ensure_tuple_rep(self.patch_size, spatial_ndim)
      # overlap
      overlap = ensure_tuple_rep(self.overlap, spatial_ndim)
      overlap = tuple(
          o if p else type(overlap[0])(0)
          for o, p in zip(overlap, patch_size)
      )
      if any(ov > ps for ov, ps in zip(overlap, patch_size)):
          raise ValueError(
              f"`overlap` ({overlap}) cannot be larger than patch size ({patch_size})."
          )
      # offset
      offset = ensure_tuple_rep(self.offset, spatial_ndim)
      for off, ps, sh in zip(offset, patch_size, spatial_shape):
          if off < -ps:
              raise ValueError(
                  f"Negative `offset` ({off}) cannot be larger than `patch_size` ({ps}) in magnitude."
              )
          if off >= sh:
              raise ValueError(
                  f"`offset` ({off}) cannot be larger than inputs size ({sh})."
              )
      return patch_size, overlap, offset
  
imports: from __future__ import annotations
  import os
  import warnings
  from abc import ABC, abstractmethod
  from collections.abc import Callable, Iterable, Sequence
  from inspect import _empty, isclass, signature
  from typing import Any
  import torch
  from monai.data.utils import iter_patch_position
  from monai.data.wsi_reader import BaseWSIReader, WSIReader
  from monai.transforms.utility.array import convert_to_tensor
  from monai.utils.misc import PathLike, ensure_tuple, ensure_tuple_rep
label_desc: Use image node_id 4 for calling the SlidingWindowSplitter obj's underlying member method code with example usage: obj._get_valid_shape_parameters(spatial_shape) and returns: patch_size,  overlap,  offset