



'''simple docstring'''






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

class 				SCREAMING_SNAKE_CASE(							nn.Module			):







	"""simple docstring"""






	lowerCamelCase__			 =       42
	lowerCamelCase__			 =       jnp.floataa







	def      A	(						self			:     str		)			->		Tuple:
								UpperCAmelCase :       Optional[Any] 							=		nn.Conv(
								    self.out_channels		,			kernel_size=(3, 3)		,			strides=(1, 1)		,			padding=((1, 1), (1, 1))		,			dtype=self.dtype		,			)







	def __call__(						self			:     Dict		,			__snake_case			:     int		)			->		List[str]:
								UpperCAmelCase							,		UpperCAmelCase							,		UpperCAmelCase							,		UpperCAmelCase :       Optional[int] 							=		hidden_states.shape
								UpperCAmelCase :       Dict 							=		jax.image.resize(
								    UpperCamelCase_		,			shape=(batch, height * 2, width * 2, channels)		,			method='''nearest'''		,			)
								UpperCAmelCase :       Union[str, Any] 							=		self.conv(UpperCamelCase_		)
								return hidden_states

class 				SCREAMING_SNAKE_CASE(							nn.Module			):







	"""simple docstring"""






	lowerCamelCase__			 =       42
	lowerCamelCase__			 =       jnp.floataa







	def      A	(						self			:     Tuple		)			->		Dict:
								UpperCAmelCase :       List[Any] 							=		nn.Conv(
								    self.out_channels		,			kernel_size=(3, 3)		,			strides=(2, 2)		,			padding=((1, 1), (1, 1))		,			dtype=self.dtype		,			)







	def __call__(						self			:     Optional[int]		,			__snake_case			:     Optional[Any]		)			->		Union[str, Any]:
								UpperCAmelCase :       Tuple 							=		self.conv(UpperCamelCase_		)
								return hidden_states

class 				SCREAMING_SNAKE_CASE(							nn.Module			):







	"""simple docstring"""






	lowerCamelCase__			 =       42
	lowerCamelCase__			 =       None
	lowerCamelCase__			 =       0.0
	lowerCamelCase__			 =       None
	lowerCamelCase__			 =       jnp.floataa







	def      A	(						self			:     List[Any]		)			->		Union[str, Any]:
								UpperCAmelCase :       Dict 							=		self.in_channels if self.out_channels is None else self.out_channels

								UpperCAmelCase :       Optional[Any] 							=		nn.GroupNorm(num_groups=32		,			epsilon=1E-5		)
								UpperCAmelCase :       Union[str, Any] 							=		nn.Conv(
								    UpperCamelCase_		,			kernel_size=(3, 3)		,			strides=(1, 1)		,			padding=((1, 1), (1, 1))		,			dtype=self.dtype		,			)

								UpperCAmelCase :       Tuple 							=		nn.Dense(UpperCamelCase_		,			dtype=self.dtype		)

								UpperCAmelCase :       int 							=		nn.GroupNorm(num_groups=32		,			epsilon=1E-5		)
								UpperCAmelCase :       str 							=		nn.Dropout(self.dropout_prob		)
								UpperCAmelCase :       str 							=		nn.Conv(
								    UpperCamelCase_		,			kernel_size=(3, 3)		,			strides=(1, 1)		,			padding=((1, 1), (1, 1))		,			dtype=self.dtype		,			)

								UpperCAmelCase :       str 							=		self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

								UpperCAmelCase :       Any 							=		None
								if use_nin_shortcut:
															UpperCAmelCase :       Optional[Any] 							=		nn.Conv(
															    UpperCamelCase_		,			kernel_size=(1, 1)		,			strides=(1, 1)		,			padding='''VALID'''		,			dtype=self.dtype		,			)







	def __call__(						self			:     Optional[Any]		,			__snake_case			:     Tuple		,			__snake_case			:     List[str]		,			__snake_case			:     str=True		)			->		Tuple:
								UpperCAmelCase :       Optional[Any] 							=		hidden_states
								UpperCAmelCase :       int 							=		self.norma(UpperCamelCase_		)
								UpperCAmelCase :       List[str] 							=		nn.swish(UpperCamelCase_		)
								UpperCAmelCase :       List[str] 							=		self.conva(UpperCamelCase_		)

								UpperCAmelCase :       Any 							=		self.time_emb_proj(nn.swish(UpperCamelCase_		)		)
								UpperCAmelCase :       int 							=		jnp.expand_dims(jnp.expand_dims(UpperCamelCase_		,			1		)		,			1		)
								UpperCAmelCase :       List[Any] 							=		hidden_states + temb

								UpperCAmelCase :       Optional[int] 							=		self.norma(UpperCamelCase_		)
								UpperCAmelCase :       str 							=		nn.swish(UpperCamelCase_		)
								UpperCAmelCase :       Optional[int] 							=		self.dropout(UpperCamelCase_		,			UpperCamelCase_		)
								UpperCAmelCase :       Tuple 							=		self.conva(UpperCamelCase_		)

								if self.conv_shortcut is not None:
															UpperCAmelCase :       Optional[Any] 							=		self.conv_shortcut(UpperCamelCase_		)

								return hidden_states + residual









def 			_a (      SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		if exponent == 1:
				return base
		if exponent % 2 == 0:
				lowercase__            =      _modexpt(SCREAMING_SNAKE_CASE						,				exponent // 2						,				SCREAMING_SNAKE_CASE     ) % modulo_value
				return (x * x) % modulo_value
		else:
				return (base * _modexpt(SCREAMING_SNAKE_CASE						,				exponent - 1						,				SCREAMING_SNAKE_CASE     )) % modulo_value
def 			_a (      SCREAMING_SNAKE_CASE = 17_77						,				SCREAMING_SNAKE_CASE = 18_55						,				SCREAMING_SNAKE_CASE = 8     ):


		"""simple docstring"""




		lowercase__            =      base
		for _ in range(1						,				SCREAMING_SNAKE_CASE     ):
				lowercase__            =      _modexpt(SCREAMING_SNAKE_CASE						,				SCREAMING_SNAKE_CASE						,				10**digits     )

		return result


if __name__ == "__main__":
			print(f"""{solution() = }""")


