code: def get_seq_mask(
      seq: torch.Tensor, seq_lens: torch.Tensor
  ) -> torch.Tensor:
      """
      Get the sequence mask based on the actual length of each sequence
      Params:
          - seq: tensor of shape [BxLxD]
          - seq_len: tensor of shape [B]
      Returns:
          - binary mask of shape [BxL]
      """
      mask = (
          torch.arange(seq.size(1))[None, :].to(seq.device)
          < seq_lens[:, None]
      )
      return mask.to(seq.device, dtype=bool)
  
file_path: NeMo/nemo/collections/asr/parts/utils/slu_utils.py
imports: from dataclasses import dataclass
  from typing import List, Optional
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.modules.transformer import BeamSearchSequenceGenerator, GreedySequenceGenerator, TopKSequenceGenerator
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.core.classes.module import NeuralModule
label_desc: Use image node_id 3 for calling a global function with example usage: get_seq_mask(seq, seq_lens) and returns: mask