class_docstr: Exportable, `torchaudio`-based implementation of Mel Spectrogram extraction.
  
  See `AudioToMelSpectrogramPreprocessor` for args.
class_docstr_tok: ["Exportable",",","`","torchaudio","`","-based","implementation","of","Mel","Spectrogram","extraction",".","See","`","AudioToMelSpectrogramPreprocessor","`","for","args","."]
code: def _apply_normalization(
      self,
      features: torch.Tensor,
      lengths: torch.Tensor,
      eps: float = 1e-5,
  ) -> torch.Tensor:
      # For consistency, this function always does a masked fill even if not normalizing.
      mask: torch.Tensor = make_seq_mask_like(
          lengths=lengths, like=features, time_dim=-1, valid_ones=False
      )
      features = features.masked_fill(mask, 0.0)
      # Maybe don't normalize
      if self._normalize_strategy is None:
          return features
      # Use the log zero guard for the sqrt zero guard
      guard_value = self._resolve_log_zero_guard_value(features.dtype)
      if (
          self._normalize_strategy == "per_feature"
          or self._normalize_strategy == "all_features"
      ):
          # 'all_features' reduces over each sample; 'per_feature' reduces over each channel
          reduce_dim = 2
          if self._normalize_strategy == "all_features":
              reduce_dim = [1, 2]
          # [B, D, T] -> [B, D, 1] or [B, 1, 1]
          means = features.sum(dim=reduce_dim, keepdim=True).div(
              lengths.view(-1, 1, 1)
          )
          stds = (
              features.sub(means)
              .masked_fill(mask, 0.0)
              .pow(2.0)
              .sum(
                  dim=reduce_dim, keepdim=True
              )  # [B, D, T] -> [B, D, 1] or [B, 1, 1]
              .div(
                  lengths.view(-1, 1, 1) - 1
              )  # assume biased estimator
              .clamp(min=guard_value)  # avoid sqrt(0)
              .sqrt()
          )
          features = (features - means) / (stds + eps)
      else:
          # Deprecating constant std/mean
          raise ValueError(
              f"Unsupported norm type: '{self._normalize_strategy}"
          )
      features = features.masked_fill(mask, 0.0)
      return features
  
imports: import math
  import random
  from typing import Optional, Tuple, Union
  import librosa
  import numpy
  import torch
  import torch.nn
  from nemo.collections.asr.parts.preprocessing.perturb import AudioAugmentor
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
  from nemo.utils import logging
label_desc: Use image node_id 10 for calling the FilterbankFeaturesTA obj's underlying member method code with example usage: obj._apply_normalization(features, lengths, eps) and returns: features, features