code: def _check_needs_no_topleft(d: Inputs, reasons: List[str]) -> None:
      # Flash does not support TopLeft, so only allow causal masks with TopLeft
      # if each batch element has equal number of queries and keys.
      if isinstance(d.attn_bias, BlockDiagonalCausalMask):
          # Flash does not support TopLeft, so only allow BlockDiagonalCausalMask
          # if each batch element has equal number of queries and keys.
          for k_start, q_start in zip_longest(
              d.attn_bias.k_seqinfo.seqstart_py,
              d.attn_bias.q_seqinfo.seqstart_py,
          ):
              if k_start != q_start:
                  reasons.append(
                      "Only support BlockDiagonalCausalMask if equal"
                      " numbers of keys and queries"
                  )
                  break
      elif isinstance(d.attn_bias, LowerTriangularMask):
          if d.query.shape[1] != d.key.shape[1]:
              reasons.append(
                  "Only support LowerTriangularMask if equal number of"
                  "keys and queries"
              )
  
imports: import os
  from dataclasses import replace
  from itertools import zip_longest
  from typing import Any, List, Optional, Set, Tuple, Union
  import torch
  from ..common import _get_storage_base, get_operator, register_operator
  from .attn_bias import AttentionBias, BlockDiagonalCausalFromBottomRightMask, BlockDiagonalCausalLocalAttentionFromBottomRightMask, BlockDiagonalCausalLocalAttentionMask, BlockDiagonalCausalMask, BlockDiagonalCausalWithOffsetPaddedKeysMask, BlockDiagonalMask, LocalAttentionFromBottomRightMask, LowerTriangularFromBottomRightLocalAttentionMask, LowerTriangularFromBottomRightMask, LowerTriangularMask
  from .common import AttentionBwOpBase, AttentionFwOpBase, Context, Gradients, Inputs, check_lastdim_alignment_stride1
label_desc: Use image node_id 4 for calling a global function with example usage: _check_needs_no_topleft(d, reasons) without return types