mr2.utils.filters.filter_separable
- mr2.utils.filters.filter_separable(x: Tensor, kernels: Sequence[Tensor], dim: Sequence[int], pad_mode: Literal['constant', 'reflect', 'replicate', 'circular', 'none'] = 'constant', pad_value: float = 0.0) Tensor[source]
Apply one-dimensional kernels successively along the selected axes.
Each step uses PyTorch-style cross-correlation without conjugating the kernel. Padding preserves the input shape unless
pad_mode='none'.- Parameters:
x (
Tensor) – Tensor to filterkernels (
Sequence[Tensor]) – List of 1D kernels to apply to the tensor xdim (
Sequence[int]) – Axes to filter over. Must have the same length as kernels.pad_mode (
Literal['constant','reflect','replicate','circular','none'], default:'constant') – Padding modepad_value (
float, default:0.0) – Padding value for pad_mode = constant
- Returns:
Filtered tensor with the promoted dtype of the input and kernels. The shape is unchanged unless
pad_mode='none', which keeps only positions where the kernel fits entirely inside the input.