code: def build_attention_mask_3d_padding(source_mask, target_mask):
      """
      Returns a 3D joint attention mask for Megatron given two 2D masks
      :param source_mask - True for non-masked, else masked [batch, src length]
      :param target_mask - True for non-masked, else masked [batch, tgt length]
      """
      mask = make_attention_mask_3d(source_mask, target_mask)
      # invert mask for Megatron
      return mask < 0.5
  
imports: import itertools
  import math
  from typing import Dict, Iterator, List, Tuple, Union
  import torch
  import torch.nn
  from torch import Tensor
label_desc: Use image node_id 20 for calling a global function with example usage: build_attention_mask_3d_padding(source_mask, target_mask) and returns: unknown