class_docstr: Self-attention special case of multi-head dot-product attention.
  This layer is deprecated in favor of ``MultiHeadDotProductAttention``.
  
  Example usage::
    >>> import flax.linen as nn
    >>> import jax, jax.numpy as jnp
    >>> layer = nn.MultiHeadDotProductAttention(num_heads=8, qkv_features=16)
    >>> variables = layer.init(jax.random.key(0), jnp.ones((4, 3, 2, 5)))
class_docstr_tok: ["Self-attention","special","case","of","multi-head","dot-product","attention",".","This","layer","is","deprecated","in","favor","of","``","MultiHeadDotProductAttention","``",".","Example","usage",":",":",">",">",">","import","flax.linen","as","nn",">",">",">","import","jax",",","jax.numpy","as","jnp",">",">",">","layer","=","nn.MultiHeadDotProductAttention","(","num_heads=8",",","qkv_features=16",")",">",">",">","variables","=","layer.init","(","jax.random.key","(","0",")",",","jnp.ones","(","(","4",",","3",",","2",",","5",")",")",")"]
docstr: Applies multi-head dot product self-attention on the input data.
  
  Projects the inputs into multi-headed query, key, and value vectors,
  applies dot-product attention and project the results to an output vector.
  
  Args:
    inputs_q: input queries of shape ``[batch_sizes..., length, features]``.
    mask: attention mask of shape ``[batch_sizes..., num_heads, query_length,
      key/value_length]``. Attention weights are masked out if their
      corresponding mask value is ``False``.
    deterministic: if false, the attention weight is masked randomly using
      dropout, whereas if true, the attention weights are deterministic.
  
  Returns:
    output of shape ``[batch_sizes..., length, features]``.
docstr_tok: ["Applies","multi-head","dot","product","self-attention","on","the","input","data",".","Projects","the","inputs","into","multi-headed","query",",","key",",","and","value","vectors",",","applies","dot-product","attention","and","project","the","results","to","an","output","vector",".","Args",":","inputs_q",":","input","queries","of","shape","``","[","batch_sizes","...",",","length",",","features","]","``",".","mask",":","attention","mask","of","shape","``","[","batch_sizes","...",",","num_heads",",","query_length",",","key\/value_length","]","``",".","Attention","weights","are","masked","out","if","their","corresponding","mask","value","is","``","False","``",".","deterministic",":","if","false",",","the","attention","weight","is","masked","randomly","using","dropout",",","whereas","if","true",",","the","attention","weights","are","deterministic",".","Returns",":","output","of","shape","``","[","batch_sizes","...",",","length",",","features","]","``","."]
code: def __call__(  # type: ignore
      self,
      inputs_q: Array,
      mask: Optional[Array] = None,
      deterministic: Optional[bool] = None,
      dropout_rng: Optional[PRNGKey] = None,
      sow_weights: bool = False,
  ):
      """Applies multi-head dot product self-attention on the input data.
  
      Projects the inputs into multi-headed query, key, and value vectors,
      applies dot-product attention and project the results to an output vector.
  
      Args:
        inputs_q: input queries of shape ``[batch_sizes..., length, features]``.
        mask: attention mask of shape ``[batch_sizes..., num_heads, query_length,
          key/value_length]``. Attention weights are masked out if their
          corresponding mask value is ``False``.
        deterministic: if false, the attention weight is masked randomly using
          dropout, whereas if true, the attention weights are deterministic.
  
      Returns:
        output of shape ``[batch_sizes..., length, features]``.
      """
      warnings.warn(
          "SelfAttention will be deprecated soon. Use "
          "`MultiHeadDotProductAttention.__call__(inputs_q)` instead. "
          "See https://github.com/google/flax/discussions/3389 "
          "for more information.",
          DeprecationWarning,
      )
      return super().__call__(
          inputs_q,
          mask=mask,
          deterministic=deterministic,
          dropout_rng=dropout_rng,
          sow_weights=sow_weights,
      )
  
imports: import functools
  import warnings
  from typing import Any, Callable, Optional, Tuple, Union, overload
  import jax
  import jax.numpy
  from jax import lax, random
  from flax.linen import initializers
  from flax.linen.dtypes import promote_dtype
  from flax.linen.linear import DenseGeneral, DotGeneralT, PrecisionLike, default_kernel_init
  from flax.linen.module import Module, compact, merge_param
  from flax.linen.normalization import LayerNorm
label_desc: Use image node_id 1 for calling the SelfAttention obj's underlying member method code with example usage: obj.__call__(inputs_q, mask, deterministic, dropout_rng, sow_weights) and returns: super