bartorch.median_filter

Contents

bartorch.median_filter#

bartorch.median_filter()#

Median over each window of length consecutive elements along axis.

Only whole windows are taken: the axis shrinks from n to n - length + 1 and out[i] is the median of input[i:i + length].

Parameters:
  • input (torch.Tensor) – Array to filter.

  • axis (int) – Axis to filter along.

  • length (int) – Window length, between one and the axis length.

  • geometric (bool, default=False) – Take the geometric median of the complex values, by ten Weiszfeld iterations from zero. Otherwise the element of median magnitude, or the mean of the two for an even length.

Returns:

input.shape with n - length + 1 along axis.

Return type:

torch.Tensor