code: def softmax_attn(scope: Scope, weights: Array):
      del scope
      norm_dims = tuple(range(weights.ndim // 2, weights.ndim))
      log_norms = jax.scipy.special.logsumexp(
          weights, axis=norm_dims, keepdims=True
      )
      return jnp.exp(weights - log_norms)
  
file_path: flax/tests/core/design/core_attention_test.py
imports: from functools import partial
  from typing import Callable, Optional, Sequence
  import jax
  from absl.testing import absltest
  from jax import lax, random
  from jax import numpy
  from flax.core import Array, Scope, init, lift, nn, unfreeze
label_desc: Use image node_id 1 for calling a global function with example usage: softmax_attn(scope, weights) and returns: jnp