code: def _rawnet_extract_embd(self, audio, n_samples=48000, n_segments=10):
      if len(audio.shape) > 1:
          raise ValueError(
              "RawNet3 supports mono input only."
              f"Input data has a shape of {audio.shape}."
          )
      if (
          len(audio) < n_samples
      ):  # RawNet3 was trained using utterances of 3 seconds
          shortage = n_samples - len(audio) + 1
          audio = np.pad(audio, (0, shortage), "wrap")
      audios = []
      startframe = np.linspace(
          0, len(audio) - n_samples, num=n_segments
      )
      for asf in startframe:
          audios.append(audio[int(asf) : int(asf) + n_samples])
      audios = torch.from_numpy(
          np.stack(audios, axis=0).astype(np.float32)
      ).to(self.device)
      with torch.no_grad():
          output = self.model(audios)
      return output.mean(0).detach().cpu().numpy()
  
file_path: espnet/egs2/libriheavy_medium/asr2/pyscripts/utils/extract_spk_embed.py
imports: import argparse
  import logging
  import os
  import sys
  from pathlib import Path
  import kaldiio
  import librosa
  import numpy
  import torch
  from tqdm.contrib import tqdm
  from espnet2.fileio.sound_scp import SoundScpReader
label_desc: Use image node_id 2 for calling the SpkEmbedExtractor obj's underlying member method code with example usage: obj._rawnet_extract_embd(audio, n_samples, n_segments) and returns: output