code: def _softmax(a: torch.Tensor, causal: bool = False) -> torch.Tensor:
      if _has_cpp_library and isinstance(a, SparseCS):
          return a.softmax()
  
      if a.is_sparse:
          return torch.sparse.softmax(a, dim=a.ndim - 1)
  
      if _is_triton_available():
          return triton_softmax(a, mask=None, causal=causal)
      else:
          return torch.softmax(a, dim=a.ndim - 1)
  
file_path: xformers/xformers/components/attention/core.py
imports: import logging
  import math
  from contextlib import nullcontext
  from functools import lru_cache
  from typing import Optional, Union
  import torch
  from xformers import _has_cpp_library, _is_triton_available
  from xformers.components.attention.attention_mask import AttentionMask
label_desc: Use image node_id 4 for calling a global function with example usage: _softmax(a, causal) and returns: a, torch, triton_softmax, torch