docstr: Apply speaker level mean and variance to the input field. Statistics are provided in JSON format, and can be
  computed using scripts.dataset_processing.tts.compute_feature_stats.py
  
  Specifically: input[field] = (input[field] + speaker_mean) / speaker_standard_deviation
  
  Stats file format example for field 'pitch':
  
  {
      "default": {
          "pitch_mean": 100.0,
          "pitch_std": 50.0,
      },
      "speaker1": {
          "pitch_mean": 110.0,
          "pitch_std": 45.0,
      },
      "speaker2": {
          "pitch_mean": 105.0,
          "pitch_std": 30.0,
      },
      ...
  }
  
  Args:
      field: Field to apply normalization to.
      stats_path: JSON file with feature mean and variance.
      speaker_field: field containing speaker ID string.
      mask_field: Optional, field in example dictionary with boolean array indicating which values to
          mask to 0. Defaults to 'voiced_mask', expected to be computed by pyin pitch estimator.
      fallback_to_default: Whether to use 'default' feature statistics when speaker is not found in
          the statistics dictionary.
docstr_tok: ["Apply","speaker","level","mean","and","variance","to","the","input","field",".","Statistics","are","provided","in","JSON","format",",","and","can","be","computed","using","scripts.dataset_processing.tts.compute_feature_stats.py","Specifically",":","input","[","field","]","=","(","input","[","field","]","+","speaker_mean",")","\/","speaker_standard_deviation","Stats","file","format","example","for","field","'pitch","'",":","{","``","default","''",":","{","``","pitch_mean","''",":","100.0",",","``","pitch_std","''",":","50.0",",","}",",","``","speaker1","''",":","{","``","pitch_mean","''",":","110.0",",","``","pitch_std","''",":","45.0",",","}",",","``","speaker2","''",":","{","``","pitch_mean","''",":","105.0",",","``","pitch_std","''",":","30.0",",","}",",","...","}","Args",":","field",":","Field","to","apply","normalization","to",".","stats_path",":","JSON","file","with","feature","mean","and","variance",".","speaker_field",":","field","containing","speaker","ID","string",".","mask_field",":","Optional",",","field","in","example","dictionary","with","boolean","array","indicating","which","values","to","mask","to","0",".","Defaults","to","'voiced_mask","'",",","expected","to","be","computed","by","pyin","pitch","estimator",".","fallback_to_default",":","Whether","to","use","'default","'","feature","statistics","when","speaker","is","not","found","in","the","statistics","dictionary","."]
code: def __init__(
      self,
      field: str,
      stats_path: Path,
      speaker_field: str = "speaker",
      mask_field: Optional[str] = "voiced_mask",
      fallback_to_default: bool = False,
  ):
      """
      Apply speaker level mean and variance to the input field. Statistics are provided in JSON format, and can be
      computed using scripts.dataset_processing.tts.compute_feature_stats.py
  
      Specifically: input[field] = (input[field] + speaker_mean) / speaker_standard_deviation
  
      Stats file format example for field 'pitch':
  
      {
          "default": {
              "pitch_mean": 100.0,
              "pitch_std": 50.0,
          },
          "speaker1": {
              "pitch_mean": 110.0,
              "pitch_std": 45.0,
          },
          "speaker2": {
              "pitch_mean": 105.0,
              "pitch_std": 30.0,
          },
          ...
      }
  
      Args:
          field: Field to apply normalization to.
          stats_path: JSON file with feature mean and variance.
          speaker_field: field containing speaker ID string.
          mask_field: Optional, field in example dictionary with boolean array indicating which values to
              mask to 0. Defaults to 'voiced_mask', expected to be computed by pyin pitch estimator.
          fallback_to_default: Whether to use 'default' feature statistics when speaker is not found in
              the statistics dictionary.
      """
  
      self.field = field
      self.key_mean = f"{self.field}_mean"
      self.key_std = f"{self.field}_std"
      self.speaker_field = speaker_field
      self.mask_field = mask_field
      self.fallback_to_default = fallback_to_default
  
      with open(stats_path, "r", encoding="utf-8") as stats_f:
          self.stats_dict = json.load(stats_f)
  
imports: import json
  from abc import ABC, abstractmethod
  from pathlib import Path
  from typing import Optional
  import torch
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 1 to create a new MeanVarianceSpeakerNormalization object from inherited base classes: FeatureProcessor with example: obj = MeanVarianceSpeakerNormalization(field, stats_path, speaker_field, mask_field, fallback_to_default)