class_docstr: F0 estimation with dio + stonemask algorithm.
  
  This is f0 extractor based on dio + stonmask algorithm introduced in `WORLD:
  a vocoder-based high-quality speech synthesis system for real-time applications`_.
  
  .. _`WORLD: a vocoder-based high-quality speech synthesis system for real-time
      applications`: https://doi.org/10.1587/transinf.2015EDP7457
  
  Note:
      This module is based on NumPy implementation. Therefore, the computational graph
      is not connected.
  
  Todo:
      Replace this module with PyTorch-based implementation.
class_docstr_tok: ["F0","estimation","with","dio","+","stonemask","algorithm",".","This","is","f0","extractor","based","on","dio","+","stonmask","algorithm","introduced","in","`","WORLD",":","a","vocoder-based","high-quality","speech","synthesis","system","for","real-time","applications","`","_",".","..","_","`","WORLD",":","a","vocoder-based","high-quality","speech","synthesis","system","for","real-time","applications","`",":","https",":","\/\/doi.org\/10.1587\/transinf.2015EDP7457","Note",":","This","module","is","based","on","NumPy","implementation",".","Therefore",",","the","computational","graph","is","not","connected",".","Todo",":","Replace","this","module","with","PyTorch-based","implementation","."]
code: def _convert_to_continuous_f0(f0: np.array) -> np.array:
      if (f0 == 0).all():
          logging.warning("All frames seems to be unvoiced.")
          return f0
  
      # padding start and end of f0 sequence
      start_f0 = f0[f0 != 0][0]
      end_f0 = f0[f0 != 0][-1]
      start_idx = np.where(f0 == start_f0)[0][0]
      end_idx = np.where(f0 == end_f0)[0][-1]
      f0[:start_idx] = start_f0
      f0[end_idx:] = end_f0
  
      # get non-zero frame index
      nonzero_idxs = np.where(f0 != 0)[0]
  
      # perform linear interpolation
      interp_fn = interp1d(nonzero_idxs, f0[nonzero_idxs])
      f0 = interp_fn(np.arange(0, f0.shape[0]))
  
      return f0
  
imports: import logging
  from typing import Any, Dict, Tuple, Union
  import humanfriendly
  import numpy
  import pyworld
  import torch
  import torch.nn.functional
  from scipy.interpolate import interp1d
  from typeguard import check_argument_types
  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 7 for calling the Dio obj's underlying member method code with example usage: obj._convert_to_continuous_f0(f0) and returns: f0, f0