mr2.utils.filters.uniform_filter
- mr2.utils.filters.uniform_filter(x: Tensor, width: int | Sequence[int] | Tensor, dim: int | Sequence[int] | None = None, pad_mode: Literal['constant', 'reflect', 'replicate', 'circular'] = 'constant', pad_value: float = 0.0) Tensor[source]
Smooth a tensor by averaging a rectangular neighborhood.
Each selected axis uses a constant kernel whose coefficients sum to one. Window widths larger than the corresponding input axis are clipped to its length.
- Parameters:
x (
Tensor) – Tensor to filterwidth (
int|Sequence[int] |Tensor) – Width of uniform kernel. If iterable, must have length equal to the number of axes.dim (
int|Sequence[int] |None, default:None) – Axis or axes to filter over. If None, filters over all axes.pad_mode (
Literal['constant','reflect','replicate','circular'], default:'constant') – Padding modepad_value (
float, default:0.0) – Padding value for pad_mode = constant
- Returns:
Smoothed tensor with the same shape as the input.