code: def _median_smoothing(indices: Tensor, win_length: int) -> Tensor:
      r"""
      Apply median smoothing to the 1D tensor over the given window.
      """
  
      # Centered windowed
      pad_length = (win_length - 1) // 2
  
      # "replicate" padding in any dimension
      indices = torch.nn.functional.pad(
          indices, (pad_length, 0), mode="constant", value=0.0
      )
  
      indices[..., :pad_length] = torch.cat(
          pad_length * [indices[..., pad_length].unsqueeze(-1)], dim=-1
      )
      roll = indices.unfold(-1, win_length, 1)
  
      values, _ = torch.median(roll, -1)
      return values
  
imports: import math
  import tempfile
  import warnings
  from collections.abc import Sequence
  from typing import List, Optional, Tuple, Union
  import torch
  import torchaudio
  from torch import Tensor
  from torchaudio._internal.module_utils import deprecated
  from .filtering import highpass_biquad, treble_biquad
label_desc: Use image node_id 24 for calling a global function with example usage: _median_smoothing(indices, win_length) and returns: values