code: def mask_along_axis(
      specgram: Tensor,
      mask_param: int,
      mask_value: float,
      axis: int,
      p: float = 1.0,
  ) -> Tensor:
      r"""Apply a mask along ``axis``.
  
      .. devices:: CPU CUDA
  
      .. properties:: Autograd TorchScript
  
      Mask will be applied from indices ``[v_0, v_0 + v)``,
      where ``v`` is sampled from ``uniform(0, max_v)`` and
      ``v_0`` from ``uniform(0, specgram.size(axis) - v)``, with
      ``max_v = mask_param`` when ``p = 1.0`` and
      ``max_v = min(mask_param, floor(specgram.size(axis) * p))``
      otherwise.
      All examples will have the same mask interval.
  
      Args:
          specgram (Tensor): Real spectrograms `(..., freq, time)`, with at least 2 dimensions.
          mask_param (int): Number of columns to be masked will be uniformly sampled from [0, mask_param]
          mask_value (float): Value to assign to the masked columns
          axis (int): Axis to apply masking on, which should be the one of the last two dimensions.
          p (float, optional): maximum proportion of columns that can be masked. (Default: 1.0)
  
      Returns:
          Tensor: Masked spectrograms with the same dimensions as input specgram Tensor
      """
      dim = specgram.dim()
  
      if dim < 2:
          raise ValueError(
              f"Spectrogram must have at least two dimensions (time and frequency) ({dim} given)."
          )
  
      if axis not in [dim - 2, dim - 1]:
          raise ValueError(
              f"Only Frequency and Time masking are supported (axis {dim-2} and axis {dim-1} supported; {axis} given)."
          )
  
      if not 0.0 <= p <= 1.0:
          raise ValueError(
              f"The value of p must be between 0.0 and 1.0 ({p} given)."
          )
  
      mask_param = _get_mask_param(mask_param, p, specgram.shape[axis])
      if mask_param < 1:
          return specgram
  
      # pack batch
      shape = specgram.size()
      specgram = specgram.reshape([-1] + list(shape[-2:]))
      # After packing, specgram is a 3D tensor, and the axis corresponding to the to-be-masked dimension
      # is now (axis - dim + 3), e.g. a tensor of shape (10, 2, 50, 10, 2) becomes a tensor of shape (1000, 10, 2).
      value = torch.rand(1) * mask_param
      min_value = torch.rand(1) * (
          specgram.size(axis - dim + 3) - value
      )
  
      mask_start = (min_value.long()).squeeze()
      mask_end = (min_value.long() + value.long()).squeeze()
      mask = torch.arange(
          0,
          specgram.shape[axis - dim + 3],
          device=specgram.device,
          dtype=specgram.dtype,
      )
      mask = (mask >= mask_start) & (mask < mask_end)
      # unsqueeze the mask if the axis is frequency
      if axis == dim - 2:
          mask = mask.unsqueeze(-1)
  
      if mask_end - mask_start >= mask_param:
          raise ValueError(
              "Number of columns to be masked should be less than mask_param"
          )
  
      specgram = specgram.masked_fill(mask, mask_value)
  
      # unpack batch
      specgram = specgram.reshape(shape[:-2] + specgram.shape[-2:])
  
      return specgram
  
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 19 for calling a global function with example usage: mask_along_axis(specgram, mask_param, mask_value, axis, p) and returns: specgram, specgram