code: def seq_to_mask(seq_len, max_len):
      """[get attention mask with sequence length]
  
      Args:
          seq_len ([torch.tensor]): [shape: bsz, each sequence length in a batch]
      """
      max_len = int(max_len) if max_len else seq_len.max().long()
      cast_seq = (
          torch.arange(max_len).expand(seq_len.size(0), -1).to(seq_len)
      )
      mask = cast_seq.lt(seq_len.unsqueeze(1))
      return mask
  
file_path: DeepKE/src/deepke/name_entity_re/few_shot/utils/util.py
imports: import torch
  import numpy
  import random
  from torch import nn
  import torch.nn.functional
  from transformers import BartModel, BartTokenizer, BertTokenizer
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: seq_to_mask(seq_len, max_len) and returns: mask