code: def get_mask_from_lengths(lengths, max_len=None):
      """Creates a binary mask from sequence lengths
      Arguments
      ---------
      lengths: torch.Tensor
          A tensor of sequence lengths
      max_len: int (Optional)
          Maximum sequence length, defaults to None.
      Returns
      -------
      mask: torch.Tensor
          the mask where padded elements are set to True.
          Then one can use tensor.masked_fill_(mask, 0) for the masking.
      Example
      -------
      >>> lengths = torch.tensor([3, 2, 4])
      >>> get_mask_from_lengths(lengths)
      tensor([[False, False, False,  True],
              [False, False,  True,  True],
              [False, False, False, False]])
      """
      if max_len is None:
          max_len = torch.max(lengths).item()
      seq_range = torch.arange(
          max_len, device=lengths.device, dtype=lengths.dtype
      )
      return ~(seq_range.unsqueeze(0) < lengths.unsqueeze(1))
  
imports: import math
  import torch
  import torch.nn
  import speechbrain
  from typing import Optional
  import numpy
  from .Conformer import ConformerEncoder
  from .Branchformer import BranchformerEncoder
  from speechbrain.nnet.activations import Swish
  from speechbrain.nnet.attention import RelPosEncXL
  from speechbrain.nnet.CNN import Conv1d
label_desc: Use image node_id 3 for calling a global function with example usage: get_mask_from_lengths(lengths, max_len) and returns: unknown