code: def sequence_mask(lengths, max_len=None):
      """
      Creates a boolean mask from sequence lengths.
      """
      max_len = max_len or lengths.max()
      return torch.arange(
          0, max_len, device=lengths.device
      ) >= lengths.unsqueeze(1)
  
imports: import torch
  import random
  from contextlib import contextmanager
  import inspect
  import numpy
  import os
  from copy import deepcopy
label_desc: Use image node_id 2 for calling a global function with example usage: sequence_mask(lengths, max_len) and returns: unknown