code: def len2mask(lens, device):
      max_len = max(lens)
      mask = (
          torch.arange(max_len, device=device)
          .unsqueeze(0)
          .expand(len(lens), max_len)
      )
      mask = mask >= torch.LongTensor(lens).to(mask).unsqueeze(1)
      return mask
  
imports: import json
  import pickle
  import random
  import dgl
  import numpy
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: len2mask(lens, device) and returns: mask