class_docstr: A ready-to-use class for Voice Activity Detection (VAD) using a
  pre-trained model.
  
  Example
  -------
  >>> import torchaudio
  >>> from speechbrain.inference.VAD import VAD
  >>> # Model is downloaded from the speechbrain HuggingFace repo
  >>> tmpdir = getfixture("tmpdir")
  >>> VAD = VAD.from_hparams(
  ...     source="speechbrain/vad-crdnn-libriparty",
  ...     savedir=tmpdir,
  ... )
  
  >>> # Perform VAD
  >>> boundaries = VAD.get_speech_segments("tests/samples/single-mic/example1.wav")
docstr: Scans the frame-level speech probabilities and applies a threshold
  on them. Speech starts when a value larger than activation_th is
  detected, while it ends when observing a value lower than
  the deactivation_th.
  
  Arguments
  ---------
  vad_prob: torch.Tensor
      Frame-level speech probabilities.
  activation_th:  float
      Threshold for starting a speech segment.
  deactivation_th: float
      Threshold for ending a speech segment.
  
  Returns
  -------
  vad_th: torch.Tensor
      Tensor containing 1 for speech regions and 0 for non-speech regions.
docstr_tok: ["Scans","the","frame-level","speech","probabilities","and","applies","a","threshold","on","them",".","Speech","starts","when","a","value","larger","than","activation_th","is","detected",",","while","it","ends","when","observing","a","value","lower","than","the","deactivation_th",".","Arguments","--","--","--","--","-","vad_prob",":","torch.Tensor","Frame-level","speech","probabilities",".","activation_th",":","float","Threshold","for","starting","a","speech","segment",".","deactivation_th",":","float","Threshold","for","ending","a","speech","segment",".","Returns","--","--","--","-","vad_th",":","torch.Tensor","Tensor","containing","1","for","speech","regions","and","0","for","non-speech","regions","."]
code: def apply_threshold(
      self, vad_prob, activation_th=0.5, deactivation_th=0.25
  ):
      """Scans the frame-level speech probabilities and applies a threshold
      on them. Speech starts when a value larger than activation_th is
      detected, while it ends when observing a value lower than
      the deactivation_th.
  
      Arguments
      ---------
      vad_prob: torch.Tensor
          Frame-level speech probabilities.
      activation_th:  float
          Threshold for starting a speech segment.
      deactivation_th: float
          Threshold for ending a speech segment.
  
      Returns
      -------
      vad_th: torch.Tensor
          Tensor containing 1 for speech regions and 0 for non-speech regions.
      """
      vad_activation = (vad_prob >= activation_th).int()
      vad_deactivation = (vad_prob >= deactivation_th).int()
      vad_th = vad_activation + vad_deactivation
  
      # Loop over batches and time steps
      for batch in range(vad_th.shape[0]):
          for time_step in range(vad_th.shape[1] - 1):
              if (
                  vad_th[batch, time_step] == 2
                  and vad_th[batch, time_step + 1] == 1
              ):
                  vad_th[batch, time_step + 1] = 2
  
      vad_th[vad_th == 1] = 0
      vad_th[vad_th == 2] = 1
      return vad_th
  
imports: import torch
  import torchaudio
  from speechbrain.utils.data_utils import split_path
  from speechbrain.utils.fetching import fetch
  from speechbrain.inference.interfaces import Pretrained
label_desc: Use image node_id 5 for calling the VAD obj's underlying member method code with example usage: obj.apply_threshold(vad_prob, activation_th, deactivation_th) and returns: vad_th