class_docstr: Generator module in VITS.
  
  This is a module of VITS described in `Conditional Variational Autoencoder
  with Adversarial Learning for End-to-End Text-to-Speech`_.
  
  As text encoder, we use conformer architecture instead of the relative positional
  Transformer, which contains additional convolution layers.
  
  .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End
      Text-to-Speech`: https://arxiv.org/abs/2006.04558
class_docstr_tok: ["Generator","module","in","VITS",".","This","is","a","module","of","VITS","described","in","`","Conditional","Variational","Autoencoder","with","Adversarial","Learning","for","End-to-End","Text-to-Speech","`","_",".","As","text","encoder",",","we","use","conformer","architecture","instead","of","the","relative","positional","Transformer",",","which","contains","additional","convolution","layers",".","..","_","`","Conditional","Variational","Autoencoder","with","Adversarial","Learning","for","End-to-End","Text-to-Speech","`",":","https",":","\/\/arxiv.org\/abs\/2006.04558"]
docstr: Generate path a.k.a. monotonic attention.
  
  Args:
      dur (Tensor): Duration tensor (B, 1, T_text).
      mask (Tensor): Attention mask tensor (B, 1, T_feats, T_text).
  
  Returns:
      Tensor: Path tensor (B, 1, T_feats, T_text).
docstr_tok: ["Generate","path","a.k.a",".","monotonic","attention",".","Args",":","dur","(","Tensor",")",":","Duration","tensor","(","B",",","1",",","T_text",")",".","mask","(","Tensor",")",":","Attention","mask","tensor","(","B",",","1",",","T_feats",",","T_text",")",".","Returns",":","Tensor",":","Path","tensor","(","B",",","1",",","T_feats",",","T_text",")","."]
code: def _generate_path(
      self, dur: torch.Tensor, mask: torch.Tensor
  ) -> torch.Tensor:
      """Generate path a.k.a. monotonic attention.
  
      Args:
          dur (Tensor): Duration tensor (B, 1, T_text).
          mask (Tensor): Attention mask tensor (B, 1, T_feats, T_text).
  
      Returns:
          Tensor: Path tensor (B, 1, T_feats, T_text).
  
      """
      b, _, t_y, t_x = mask.shape
      cum_dur = torch.cumsum(dur, -1)
      cum_dur_flat = cum_dur.view(b * t_x)
      path = torch.arange(t_y, dtype=dur.dtype, device=dur.device)
      path = path.unsqueeze(0) < cum_dur_flat.unsqueeze(1)
      path = path.view(b, t_x, t_y).to(dtype=mask.dtype)
      # path will be like (t_x = 3, t_y = 5):
      # [[[1., 1., 0., 0., 0.],      [[[1., 1., 0., 0., 0.],
      #   [1., 1., 1., 1., 0.],  -->   [0., 0., 1., 1., 0.],
      #   [1., 1., 1., 1., 1.]]]       [0., 0., 0., 0., 1.]]]
      path = path - F.pad(path, [0, 0, 1, 0, 0, 0])[:, :-1]
      return path.unsqueeze(1).transpose(2, 3) * mask
  
file_path: espnet/espnet2/gan_tts/vits/generator.py
imports: import math
  from typing import List, Optional, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_tts.hifigan import HiFiGANGenerator
  from espnet2.gan_tts.utils import get_random_segments
  from espnet2.gan_tts.vits.duration_predictor import StochasticDurationPredictor
  from espnet2.gan_tts.vits.posterior_encoder import PosteriorEncoder
  from espnet2.gan_tts.vits.residual_coupling import ResidualAffineCouplingBlock
  from espnet2.gan_tts.vits.text_encoder import TextEncoder
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 4 for calling the VITSGenerator obj's underlying member method code with example usage: obj._generate_path(dur, mask) and returns: unknown