code: def _get_tensor_bias(
      attn_bias: Optional[Union[torch.Tensor, AttentionBias]]
  ) -> Optional[torch.Tensor]:
      if isinstance(attn_bias, torch.Tensor):
          return attn_bias
      elif isinstance(attn_bias, LowerTriangularMaskWithTensorBias):
          return attn_bias._bias
      return None
  
imports: from dataclasses import replace
  from enum import Enum
  from functools import partial
  from typing import Any, List, Optional, Set, Tuple, Union
  import torch
  from ..common import get_xformers_operator, register_operator
  from .None import attn_bias
  from .attn_bias import AttentionBias, BlockDiagonalCausalLocalAttentionFromBottomRightMask, BlockDiagonalCausalLocalAttentionMask, BlockDiagonalCausalMask, BlockDiagonalCausalWithOffsetPaddedKeysMask, BlockDiagonalMask, LowerTriangularFromBottomRightLocalAttentionMask, LowerTriangularFromBottomRightMask, LowerTriangularMask, LowerTriangularMaskWithTensorBias
  from .common import AttentionBwOpBase, AttentionFwOpBase, Context, Gradients, Inputs, _attn_bias_apply, check_lastdim_alignment_stride1
label_desc: Use image node_id 4 for calling a global function with example usage: _get_tensor_bias(attn_bias) and returns: None, attn_bias, attn_bias