code: def pad_2d_mask(
      input: List[List[int]],
      pad_value: int = 0,
      seq_padding_control: Optional[List[int]] = None,
      max_seq_pad_len: int = -1,
      batch_padding_control: Optional[List[int]] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Pad a list to a 2d tensor. Returns a pair of tensors, the padded tensor
      as well as a mask tensor. The mask tensor has the same shape as the padded tensor,
      with a 1 in the position of non-pad values and a 0 in the position of pads.
      If padding_control is set, perform padding according to the specified padding style
      """
  
      # List comprehension required for TorchScript
      max_seq_len = max([len(i) for i in input])  # noqa
      max_seq_len = pad_length(
          max_seq_len, seq_padding_control, max_seq_pad_len
      )
  
      max_batch_len = len(input)
      max_batch_len = pad_length(
          max_batch_len, batch_padding_control, -1
      )
  
      return torch.ops.fb.ragged_indices_to_padded_tensor_and_mask(
          input, pad_value, max_batch_len, max_seq_len
      )
  
imports: from typing import List, NamedTuple, Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: pad_2d_mask(input, pad_value, seq_padding_control, max_seq_pad_len, batch_padding_control) and returns: torch