code: def openfold_attention_eager(
      query: torch.Tensor,
      key: torch.Tensor,
      value: torch.Tensor,
      mask: torch.Tensor,
      bias: Optional[torch.Tensor],
      inf: float,
  ) -> torch.Tensor:
      # query:  [*, num_heads, Q, c_hidden]
      # key:    [*, num_heads, K, c_hidden]
      # value:  [*, num_heads, V, c_hidden]
      # mask:   Logit mask tensor broadcastable to [*, num_heads, Q, K]
      # bias:   Optional logit bias tensor broadcastable to [*, num_heads, Q, K]
      # inf:    Safe infinity value.
      # assuming K == V
  
      key = torch.swapdims(key, -2, -1)
      # key: [*, num_heads, c_hidden, K]
  
      scaling = 1.0 / math.sqrt(query.size(-1))
      a = torch.matmul(query * scaling, key)
      # a: [*, num_heads, Q, K]
  
      a += (mask - 1.0) * inf
      # a: [*, num_heads, Q, K]
  
      if bias is not None:
          a += bias
      # a: [*, num_heads, Q, K]
  
      a = torch.softmax(a, dim=-1)
      # a: [*, num_heads, Q, K]
  
      a = torch.matmul(a, value)
      # a: [*, num_heads, Q, c_hidden]
  
      return a
  
file_path: apex/apex/contrib/test/openfold_triton/test_openfold_mha.py
imports: import math
  import random
  from typing import Optional
  import torch
  import unittest
label_desc: Use image node_id 1 for calling a global function with example usage: openfold_attention_eager(query, key, value, mask, bias, inf) and returns: a