code: def sequence_mask(sequence_length, max_len=None):
      """Create a sequence mask for filtering padding in a sequence tensor.
  
      Args:
          sequence_length (torch.tensor): Sequence lengths.
          max_len (int, Optional): Maximum sequence length. Defaults to None.
  
      Shapes:
          - mask: :math:`[B, T_max]`
      """
      if max_len is None:
          max_len = sequence_length.max()
      seq_range = torch.arange(
          max_len,
          dtype=sequence_length.dtype,
          device=sequence_length.device,
      )
      # B x T_max
      return seq_range.unsqueeze(0) < sequence_length.unsqueeze(1)
  
imports: import numpy
  import torch
  from scipy.stats import betabinom
  from torch.nn import functional
label_desc: Use image node_id 1 for calling a global function with example usage: sequence_mask(sequence_length, max_len) and returns: unknown