code: def test_save_and_load_energy_segments(self, test_data_dir):
      energy_name = "energy_test"
      offset1 = 0.0
      duration1 = 1.0
      offset2 = 1.0
      duration2 = 1.5
      start1, end1 = self._compute_start_end_frames(
          offset=offset1, duration=duration1
      )
      start2, end2 = self._compute_start_end_frames(
          offset=offset2, duration=duration2
      )
      manifest_entry_segment1 = {
          "audio_filepath": self.audio_filename,
          "offset": offset1,
          "duration": duration1,
      }
      manifest_entry_segment2 = {
          "audio_filepath": self.audio_filename,
          "offset": offset2,
          "duration": duration2,
      }
  
      mel_featurizer = MelSpectrogramFeaturizer(
          mel_dim=self.spec_dim,
          hop_length=self.hop_len,
          sample_rate=self.sample_rate,
      )
      energy_featurizer = EnergyFeaturizer(
          feature_name=energy_name, spec_featurizer=mel_featurizer
      )
  
      with self._create_test_dir() as test_dir:
          feature_dir = test_dir / "feature"
          energy_featurizer.save(
              manifest_entry=self.manifest_entry,
              audio_dir=test_dir,
              feature_dir=feature_dir,
          )
          energy_dict = energy_featurizer.load(
              manifest_entry=self.manifest_entry,
              audio_dir=test_dir,
              feature_dir=feature_dir,
          )
          energy_dict_segment1 = energy_featurizer.load(
              manifest_entry=manifest_entry_segment1,
              audio_dir=test_dir,
              feature_dir=feature_dir,
          )
          energy_dict_segment2 = energy_featurizer.load(
              manifest_entry=manifest_entry_segment2,
              audio_dir=test_dir,
              feature_dir=feature_dir,
          )
  
      energy = energy_dict[energy_name]
      energy_segment1 = energy_dict_segment1[energy_name]
      energy_segment2 = energy_dict_segment2[energy_name]
  
      torch.testing.assert_close(energy_segment1, energy[start1:end1])
      torch.testing.assert_close(energy_segment2, energy[start2:end2])
  
imports: import contextlib
  import tempfile
  from pathlib import Path
  import numpy
  import pytest
  import soundfile
  import torch
  from nemo.collections.tts.parts.preprocessing.features import EnergyFeaturizer, MelSpectrogramFeaturizer, PitchFeaturizer
label_desc: Use image node_id 12 for calling the TestTTSFeatures obj's underlying member method code with example usage: obj.test_save_and_load_energy_segments(test_data_dir) without return types