code: def multi_head_attention_forward(
      query,
      key,
      value,
      embed_dim_to_check,
      num_heads,
      in_proj_weight,
      in_proj_bias,
      bias_k,
      bias_v,
      add_zero_attn,
      dropout_p,
      out_proj_weight,
      out_proj_bias,
      training=True,
      key_padding_mask=None,
      need_weights=True,
      attn_mask=None,
      use_separate_proj_weight=False,
      q_proj_weight=None,
      k_proj_weight=None,
      v_proj_weight=None,
      static_k=None,
      static_v=None,
      average_attn_weights=True,
      is_causal=False,
  ):
      embed_dim = query.shape[-1]
      assert (
          embed_dim == embed_dim_to_check
      ), f"was expecting embedding dimension of {embed_dim_to_check}, but got {embed_dim}"
      return ivy.multi_head_attention(
          query,
          key=key,
          value=value,
          batch_first=False,
          num_heads=num_heads,
          attention_mask=attn_mask,
          in_proj_weights=in_proj_weight
          if not use_separate_proj_weight
          else None,
          q_proj_weights=q_proj_weight,
          k_proj_weights=k_proj_weight,
          v_proj_weights=v_proj_weight,
          out_proj_weights=out_proj_weight,
          in_proj_bias=in_proj_bias,
          out_proj_bias=out_proj_bias,
          is_causal=is_causal
          and not (need_weights or key_padding_mask is not None),
          key_padding_mask=key_padding_mask,
          bias_k=bias_k,
          bias_v=bias_v,
          static_k=static_k,
          static_v=static_v,
          add_zero_attn=add_zero_attn,
          return_attention_weights=need_weights,
          average_attention_weights=average_attn_weights,
          dropout=dropout_p,
          training=training,
      )
  
file_path: ivy/ivy/functional/frontends/torch/nn/functional/layer_functions.py
imports: import ivy
  from ivy.func_wrapper import with_supported_device_and_dtypes, with_supported_dtypes
  from ivy.functional.frontends.torch.func_wrapper import to_ivy_arrays_and_back
label_desc: Use image node_id 5 for calling a global function with example usage: multi_head_attention_forward(query, key, value, embed_dim_to_check, num_heads, in_proj_weight, in_proj_bias, bias_k, bias_v, add_zero_attn, dropout_p, out_proj_weight, out_proj_bias, training, key_padding_mask, need_weights, attn_mask, use_separate_proj_weight, q_proj_weight, k_proj_weight, v_proj_weight, static_k, static_v, average_attn_weights, is_causal) and returns: ivy