mrpro.utils.sliding_window.sliding_window
- mrpro.utils.sliding_window.sliding_window(x: Tensor, window_shape: int | Sequence[int], axis: int | Sequence[int] | None = None, strides: int | Sequence[int] = 1) Tensor [source]
Sliding window view into the tensor x.
Returns a view into the tensor x that represents a sliding window. The window-axes will be at the end in the order of the axis argument. Non-overlapping windows can be achieved by setting the strides to the window_shape. Note that the stride argument is experimental and not fully supported.
- Parameters:
x – Tensor to slide over
window_shape – Size of window over each axis that takes part in the sliding window.
axis – Axis or axes to slide over. If None, slides over all axes.
strides – Stride of the sliding window. Experimental.