code: def get_mask_from_lengths(lengths: torch.Tensor) -> torch.Tensor:
      batch_size = lengths.shape[0]
      max_len = torch.max(lengths).item()
      ids = (
          torch.arange(0, max_len, device=lengths.device)
          .unsqueeze(0)
          .expand(batch_size, -1)
      )
      mask = ids >= lengths.unsqueeze(1).expand(-1, max_len)
      return mask
  
imports: from typing import List, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from TTS.tts.layers.delightful_tts.conformer import ConformerMultiHeadedSelfAttention
  from TTS.tts.layers.delightful_tts.conv_layers import CoordConv1d
  from TTS.tts.layers.delightful_tts.networks import STL
label_desc: Use image node_id 1 for calling a global function with example usage: get_mask_from_lengths(lengths) and returns: mask