class_docstr: Generator module in JETS.
docstr: Make masks for self-attention.
  
  Args:
      ilens (LongTensor): Batch of lengths (B,).
  
  Returns:
      Tensor: Mask tensor for self-attention.
          dtype=torch.uint8 in PyTorch 1.2-
          dtype=torch.bool in PyTorch 1.2+ (including 1.2)
  
  Examples:
      >>> ilens = [5, 3]
      >>> self._source_mask(ilens)
      tensor([[[1, 1, 1, 1, 1],
               [1, 1, 1, 0, 0]]], dtype=torch.uint8)
docstr_tok: ["Make","masks","for","self-attention",".","Args",":","ilens","(","LongTensor",")",":","Batch","of","lengths","(","B",",",")",".","Returns",":","Tensor",":","Mask","tensor","for","self-attention",".","dtype=torch.uint8","in","PyTorch","1.2-","dtype=torch.bool","in","PyTorch","1.2+","(","including","1.2",")","Examples",":",">",">",">","ilens","=","[","5",",","3","]",">",">",">","self._source_mask","(","ilens",")","tensor","(","[","[","[","1",",","1",",","1",",","1",",","1","]",",","[","1",",","1",",","1",",","0",",","0","]","]","]",",","dtype=torch.uint8",")"]
code: def _source_mask(self, ilens: torch.Tensor) -> torch.Tensor:
      """Make masks for self-attention.
  
      Args:
          ilens (LongTensor): Batch of lengths (B,).
  
      Returns:
          Tensor: Mask tensor for self-attention.
              dtype=torch.uint8 in PyTorch 1.2-
              dtype=torch.bool in PyTorch 1.2+ (including 1.2)
  
      Examples:
          >>> ilens = [5, 3]
          >>> self._source_mask(ilens)
          tensor([[[1, 1, 1, 1, 1],
                   [1, 1, 1, 0, 0]]], dtype=torch.uint8)
  
      """
      x_masks = make_non_pad_mask(ilens).to(
          next(self.parameters()).device
      )
      return x_masks.unsqueeze(-2)
  
imports: import logging
  from typing import Any, Dict, List, Optional, Sequence, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_tts.hifigan import HiFiGANGenerator
  from espnet2.gan_tts.jets.alignments import AlignmentModule, average_by_duration, viterbi_decode
  from espnet2.gan_tts.jets.length_regulator import GaussianUpsampling
  from espnet2.gan_tts.utils import get_random_segments
  from espnet2.torch_utils.initialize import initialize
  from espnet2.tts.fastspeech2.variance_predictor import VariancePredictor
  from espnet2.tts.gst.style_encoder import StyleEncoder
  from espnet.nets.pytorch_backend.conformer.encoder import Encoder
  from espnet.nets.pytorch_backend.fastspeech.duration_predictor import DurationPredictor
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask, make_pad_mask
  from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
label_desc: Use image node_id 5 for calling the JETSGenerator obj's underlying member method code with example usage: obj._source_mask(ilens) and returns: x_masks