code: def sinusoidal_init(
      max_len: int = 2048,
      min_scale: float = 1.0,
      max_scale: float = 10000.0,
  ):
      """1D Sinusoidal Position Embedding Initializer.
  
      Args:
          max_len: Maximum possible length for the input.
          min_scale: Minimum frequency-scale in sine grating.
          max_scale: Maximum frequency-scale in sine grating.
  
      Returns:
          output: init function returning `(1, max_len, d_feature)`
      """
  
      def init(key, shape, dtype=np.float32):
          """Sinusoidal init."""
          del key, dtype
          d_feature = shape[-1]
          pe = np.zeros((max_len, d_feature), dtype=np.float32)
          position = np.arange(0, max_len)[:, np.newaxis]
          scale_factor = -np.log(max_scale / min_scale) / (
              d_feature // 2 - 1
          )
          div_term = min_scale * np.exp(
              np.arange(0, d_feature // 2) * scale_factor
          )
          pe[:, : d_feature // 2] = np.sin(position * div_term)
          pe[:, d_feature // 2 : 2 * (d_feature // 2)] = np.cos(
              position * div_term
          )
          pe = pe[np.newaxis, :, :]  # [1, max_len, d_feature]
          return jnp.array(pe)
  
      return init
  
imports: from typing import Any, Callable, Optional, Sequence, Tuple, Union
  import flax.linen
  import jax
  from jax.nn import initializers
  import jax.numpy
  import numpy
  from scenic.model_lib.layers import nn_layers
label_desc: Use image node_id 2 for calling a global function with example usage: sinusoidal_init(max_len, min_scale, max_scale) and returns: init, jnp