


"""simple docstring"""


import math

import flax.linen as nn
import jax.numpy as jnp


def _lowerCamelCase	(		_UpperCamelCase    , _UpperCamelCase    , _UpperCamelCase = 1    , _UpperCamelCase = 1    , _UpperCamelCase = 1.0e4    , _UpperCamelCase = False    , _UpperCamelCase = 1.0    , ):

			'''simple docstring'''




			assert timesteps.ndim == 1, "Timesteps should be a 1d-array"
			assert embedding_dim % 2 == 0, f"Embedding dimension {embedding_dim} should be even"
			__lowerCAmelCase				    =			float(embedding_dim // 2      )
			__lowerCAmelCase				    =			math.log(max_timescale / min_timescale      ) / (num_timescales - freq_shift)
			__lowerCAmelCase				    =			min_timescale * jnp.exp(jnp.arange(_UpperCamelCase    , dtype=jnp.floataa      ) * -log_timescale_increment      )
			__lowerCAmelCase				    =			jnp.expand_dims(_UpperCamelCase    , 1      ) * jnp.expand_dims(_UpperCamelCase    , 0      )

			# scale embeddings
			__lowerCAmelCase				    =			scale * emb

			if flip_sin_to_cos:
						__lowerCAmelCase				    =			jnp.concatenate([jnp.cos(_UpperCamelCase      ), jnp.sin(_UpperCamelCase      )]    , axis=1      )
			else:
						__lowerCAmelCase				    =			jnp.concatenate([jnp.sin(_UpperCamelCase      ), jnp.cos(_UpperCamelCase      )]    , axis=1      )
			__lowerCAmelCase				    =			jnp.reshape(_UpperCamelCase    , [jnp.shape(_UpperCamelCase      )[0], embedding_dim]      )
			return signal
class   _UpperCamelCase  (   nn.Module		):
							'''simple docstring'''







							__UpperCAmelCase						:    int				      =3_2
							__UpperCAmelCase						:    jnp.dtype				      =jnp.floataa

							@nn.compact
							def __call__(     self    ,   __a	):
										__lowerCAmelCase				    =			nn.Dense(self.time_embed_dim    ,   dtype=self.dtype    ,   name="linear_1"	)(__a	)
										__lowerCAmelCase				    =			nn.silu(__a	)
										__lowerCAmelCase				    =			nn.Dense(self.time_embed_dim    ,   dtype=self.dtype    ,   name="linear_2"	)(__a	)
										return temb
class   _UpperCamelCase  (   nn.Module		):
							'''simple docstring'''







							__UpperCAmelCase						:    int				      =3_2
							__UpperCAmelCase						:    bool				      =False
							__UpperCAmelCase						:    float				      =1

							@nn.compact
							def __call__(     self    ,   __a	):
										return get_sinusoidal_embeddings(
										    __a    ,   embedding_dim=self.dim    ,   flip_sin_to_cos=self.flip_sin_to_cos    ,   freq_shift=self.freq_shift	)








"""simple docstring"""


def _lowerCamelCase	(		):

			'''simple docstring'''




			__lowerCAmelCase				    =			[]
			__lowerCAmelCase				    =			1

			while len(_UpperCamelCase      ) < 1e6:
						constant.append(str(_UpperCamelCase      )      )
						i += 1

			__lowerCAmelCase				    =			"".join(_UpperCamelCase      )

			return (
			    int(constant[0]      )
			    * int(constant[9]      )
			    * int(constant[99]      )
			    * int(constant[999]      )
			    * int(constant[9999]      )
			    * int(constant[9_9999]      )
			    * int(constant[99_9999]      )
			)


if __name__ == "__main__":
	print(solution())




