code: def _is_causal(
      attn_bias: Optional[Union[torch.Tensor, AttentionBias]]
  ) -> bool:
      return isinstance(
          attn_bias,
          (
              LowerTriangularMask,
              LowerTriangularFromBottomRightMask,
              LowerTriangularFromBottomRightLocalAttentionMask,
              BlockDiagonalCausalMask,
              BlockDiagonalCausalLocalAttentionMask,
              BlockDiagonalCausalFromBottomRightMask,
              BlockDiagonalCausalLocalAttentionFromBottomRightMask,
              BlockDiagonalCausalWithOffsetPaddedKeysMask,
          ),
      )
  
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 2 for calling a global function with example usage: _is_causal(attn_bias) and returns: isinstance