class_docstr: Energy extractor.
code: def __init__(
      self,
      fs: Union[int, str] = 22050,
      n_fft: int = 1024,
      win_length: int = None,
      hop_length: int = 256,
      window: str = "hann",
      center: bool = True,
      normalized: bool = False,
      onesided: bool = True,
      use_token_averaged_energy: bool = True,
      reduction_factor: int = None,
  ):
      assert check_argument_types()
      super().__init__()
      if isinstance(fs, str):
          fs = humanfriendly.parse_size(fs)
  
      self.fs = fs
      self.n_fft = n_fft
      self.hop_length = hop_length
      self.win_length = win_length
      self.window = window
      self.use_token_averaged_energy = use_token_averaged_energy
      if use_token_averaged_energy:
          assert reduction_factor >= 1
      self.reduction_factor = reduction_factor
  
      self.stft = Stft(
          n_fft=n_fft,
          win_length=win_length,
          hop_length=hop_length,
          window=window,
          center=center,
          normalized=normalized,
          onesided=onesided,
      )
  
file_path: espnet/espnet2/tts/feats_extract/energy.py
imports: from typing import Any, Dict, Tuple, Union
  import humanfriendly
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.layers.stft import Stft
  from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract
  from espnet.nets.pytorch_backend.nets_utils import pad_list
label_desc: Use image node_id 1 to create a new Energy object from inherited base classes: AbsFeatsExtract with example: obj = Energy(fs, n_fft, win_length, hop_length, window, center, normalized, onesided, use_token_averaged_energy, reduction_factor)