code: def to_padding_mask(seq_lens: Tensor, batch_seq_len: int) -> Tensor:
      """Convert a sequence length array to a boolean padding mask tensor.
  
      :param seq_lens:
          An array where each element represents the length of a sequence. *Shape:*
          :math:`(N)`, where :math:`N` is the batch size.
      :param batch_seq_len:
          The sequence length of the mask.
  
      :returns:
          The mask. *Shape:* :math:`(N,S)`, where :math:`N` is the batch size and
          :math:`S` is the sequence length.
      """
      batch_size = seq_lens.size(0)
  
      # (N, S)
      indices = torch.arange(
          batch_seq_len, device=seq_lens.device
      ).expand(batch_size, -1)
  
      # (N) -> (N, S)
      lengths = seq_lens.unsqueeze(1).expand(-1, batch_seq_len)
  
      return indices < lengths
  
file_path: fairseq2/src/fairseq2/nn/padding.py
imports: from __future__ import annotations
  from typing import Any, Optional, Sequence, Tuple, cast
  import torch
  from torch import Tensor
  from fairseq2.data import Collater, SequenceData
  from fairseq2.typing import Device
label_desc: Use image node_id 1 for calling a global function with example usage: to_padding_mask(seq_lens, batch_seq_len) and returns: unknown