code: def mask_from_lens(lens, max_len: Optional[int] = None):
      if max_len is None:
          max_len = lens.max()
      ids = torch.arange(
          0, max_len, device=lens.device, dtype=lens.dtype
      )
      mask = torch.lt(ids, lens.unsqueeze(1))
      return mask
  
imports: from typing import Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from nemo.collections.tts.modules.submodules import ConditionalInput, ConditionalLayerNorm, LinearNorm
  from nemo.collections.tts.parts.utils.helpers import get_mask_from_lengths
  from nemo.core.classes import NeuralModule, adapter_mixins, typecheck
  from nemo.core.neural_types.elements import EncodedRepresentation, LengthsType, MaskType, TokenIndex
  from nemo.core.neural_types.neural_type import NeuralType
label_desc: Use image node_id 1 for calling a global function with example usage: mask_from_lens(lens, max_len) and returns: mask