class_docstr: Duration predictor module.
  
  This is a module of duration predictor described
  in `FastSpeech: Fast, Robust and Controllable Text to Speech`_.
  The duration predictor predicts a duration of each frame in log domain
  from the hidden embeddings of encoder.
  
  .. _`FastSpeech: Fast, Robust and Controllable Text to Speech`:
      https://arxiv.org/pdf/1905.09263.pdf
  
  Note:
      The calculation domain of outputs is different
      between in `forward` and in `inference`. In `forward`,
      the outputs are calculated in log domain but in `inference`,
      those are calculated in linear domain.
code: def _forward(self, xs, x_masks=None, is_inference=False):
      xs = xs.transpose(1, -1)  # (B, idim, Tmax)
      for f in self.conv:
          xs = f(xs)  # (B, C, Tmax)
  
      # NOTE: calculate in log domain
      xs = self.linear(xs.transpose(1, -1)).squeeze(-1)  # (B, Tmax)
  
      if is_inference:
          # NOTE: calculate in linear domain
          xs = torch.clamp(
              torch.round(xs.exp() - self.offset), min=0
          ).long()  # avoid negative value
  
      if x_masks is not None:
          xs = xs.masked_fill(x_masks, 0.0)
  
      return xs
  
file_path: espnet/espnet/nets/pytorch_backend/fastspeech/duration_predictor.py
imports: import torch
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
label_desc: Use image node_id 2 for calling the DurationPredictor obj's underlying member method code with example usage: obj._forward(xs, x_masks, is_inference) and returns: xs