


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

from .attention_flax import FlaxTransformeraDModel
from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD

class 		__a      (				nn.Module			):
		_a	:  int
		_a	:  int
		_a	:  float				=	0.0
		_a	:  int				=	1
		_a	:  int				=	1
		_a	:  bool				=	True
		_a	:  bool				=	False
		_a	:  bool				=	False
		_a	:  bool				=	False
		_a	:  jnp.dtype				=	jnp.floataa
		def 	UpperCAmelCase__				(			self						) ->       Optional[Any]:




									"""simple docstring"""





									_UpperCAmelCase 		=			[]
									_UpperCAmelCase 		=			[]

									for i in range(self.num_layers						):
																_UpperCAmelCase 		=			self.in_channels if i == 0 else self.out_channels

																_UpperCAmelCase 		=			FlaxResnetBlockaD(
																    in_channels=UpperCAmelCase_			,    out_channels=self.out_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
																resnets.append(UpperCAmelCase_						)

																_UpperCAmelCase 		=			FlaxTransformeraDModel(
																    in_channels=self.out_channels			,    n_heads=self.num_attention_heads			,    d_head=self.out_channels // self.num_attention_heads			,    depth=1			,    use_linear_projection=self.use_linear_projection			,    only_cross_attention=self.only_cross_attention			,    use_memory_efficient_attention=self.use_memory_efficient_attention			,    dtype=self.dtype			,    )
																attentions.append(UpperCAmelCase_						)

									_UpperCAmelCase 		=			resnets
									_UpperCAmelCase 		=			attentions

									if self.add_downsample:
																_UpperCAmelCase 		=			FlaxDownsampleaD(self.out_channels			,    dtype=self.dtype						)






		def __call__(			self			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE=True						) ->       Union[str, Any]:




									"""simple docstring"""





									_UpperCAmelCase 		=			()

									for resnet, attn in zip(self.resnets			,    self.attentions						):
																_UpperCAmelCase 		=			resnet(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)
																_UpperCAmelCase 		=			attn(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)
																output_states += (hidden_states,)

									if self.add_downsample:
																_UpperCAmelCase 		=			self.downsamplers_a(UpperCAmelCase_						)
																output_states += (hidden_states,)

									return hidden_states, output_states



class 		__a      (				nn.Module			):
		_a	:  int
		_a	:  int
		_a	:  float				=	0.0
		_a	:  int				=	1
		_a	:  bool				=	True
		_a	:  jnp.dtype				=	jnp.floataa
		def 	UpperCAmelCase__				(			self						) ->       Optional[int]:




									"""simple docstring"""





									_UpperCAmelCase 		=			[]

									for i in range(self.num_layers						):
																_UpperCAmelCase 		=			self.in_channels if i == 0 else self.out_channels

																_UpperCAmelCase 		=			FlaxResnetBlockaD(
																    in_channels=UpperCAmelCase_			,    out_channels=self.out_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
																resnets.append(UpperCAmelCase_						)
									_UpperCAmelCase 		=			resnets

									if self.add_downsample:
																_UpperCAmelCase 		=			FlaxDownsampleaD(self.out_channels			,    dtype=self.dtype						)






		def __call__(			self			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE=True						) ->       Union[str, Any]:




									"""simple docstring"""





									_UpperCAmelCase 		=			()

									for resnet in self.resnets:
																_UpperCAmelCase 		=			resnet(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)
																output_states += (hidden_states,)

									if self.add_downsample:
																_UpperCAmelCase 		=			self.downsamplers_a(UpperCAmelCase_						)
																output_states += (hidden_states,)

									return hidden_states, output_states



class 		__a      (				nn.Module			):
		_a	:  int
		_a	:  int
		_a	:  int
		_a	:  float				=	0.0
		_a	:  int				=	1
		_a	:  int				=	1
		_a	:  bool				=	True
		_a	:  bool				=	False
		_a	:  bool				=	False
		_a	:  bool				=	False
		_a	:  jnp.dtype				=	jnp.floataa
		def 	UpperCAmelCase__				(			self						) ->       Any:




									"""simple docstring"""





									_UpperCAmelCase 		=			[]
									_UpperCAmelCase 		=			[]

									for i in range(self.num_layers						):
																_UpperCAmelCase 		=			self.in_channels if (i == self.num_layers - 1) else self.out_channels
																_UpperCAmelCase 		=			self.prev_output_channel if i == 0 else self.out_channels

																_UpperCAmelCase 		=			FlaxResnetBlockaD(
																    in_channels=resnet_in_channels + res_skip_channels			,    out_channels=self.out_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
																resnets.append(UpperCAmelCase_						)

																_UpperCAmelCase 		=			FlaxTransformeraDModel(
																    in_channels=self.out_channels			,    n_heads=self.num_attention_heads			,    d_head=self.out_channels // self.num_attention_heads			,    depth=1			,    use_linear_projection=self.use_linear_projection			,    only_cross_attention=self.only_cross_attention			,    use_memory_efficient_attention=self.use_memory_efficient_attention			,    dtype=self.dtype			,    )
																attentions.append(UpperCAmelCase_						)

									_UpperCAmelCase 		=			resnets
									_UpperCAmelCase 		=			attentions

									if self.add_upsample:
																_UpperCAmelCase 		=			FlaxUpsampleaD(self.out_channels			,    dtype=self.dtype						)






		def __call__(			self			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE=True						) ->       List[str]:




									"""simple docstring"""





									for resnet, attn in zip(self.resnets			,    self.attentions						):
																# pop res hidden states
																_UpperCAmelCase 		=			res_hidden_states_tuple[-1]
																_UpperCAmelCase 		=			res_hidden_states_tuple[:-1]
																_UpperCAmelCase 		=			jnp.concatenate((hidden_states, res_hidden_states)			,    axis=-1						)

																_UpperCAmelCase 		=			resnet(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)
																_UpperCAmelCase 		=			attn(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)

									if self.add_upsample:
																_UpperCAmelCase 		=			self.upsamplers_a(UpperCAmelCase_						)

									return hidden_states



class 		__a      (				nn.Module			):
		_a	:  int
		_a	:  int
		_a	:  int
		_a	:  float				=	0.0
		_a	:  int				=	1
		_a	:  bool				=	True
		_a	:  jnp.dtype				=	jnp.floataa
		def 	UpperCAmelCase__				(			self						) ->       Dict:




									"""simple docstring"""





									_UpperCAmelCase 		=			[]

									for i in range(self.num_layers						):
																_UpperCAmelCase 		=			self.in_channels if (i == self.num_layers - 1) else self.out_channels
																_UpperCAmelCase 		=			self.prev_output_channel if i == 0 else self.out_channels

																_UpperCAmelCase 		=			FlaxResnetBlockaD(
																    in_channels=resnet_in_channels + res_skip_channels			,    out_channels=self.out_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
																resnets.append(UpperCAmelCase_						)

									_UpperCAmelCase 		=			resnets

									if self.add_upsample:
																_UpperCAmelCase 		=			FlaxUpsampleaD(self.out_channels			,    dtype=self.dtype						)






		def __call__(			self			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE=True						) ->       List[str]:




									"""simple docstring"""





									for resnet in self.resnets:
																# pop res hidden states
																_UpperCAmelCase 		=			res_hidden_states_tuple[-1]
																_UpperCAmelCase 		=			res_hidden_states_tuple[:-1]
																_UpperCAmelCase 		=			jnp.concatenate((hidden_states, res_hidden_states)			,    axis=-1						)

																_UpperCAmelCase 		=			resnet(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)

									if self.add_upsample:
																_UpperCAmelCase 		=			self.upsamplers_a(UpperCAmelCase_						)

									return hidden_states



class 		__a      (				nn.Module			):
		_a	:  int
		_a	:  float				=	0.0
		_a	:  int				=	1
		_a	:  int				=	1
		_a	:  bool				=	False
		_a	:  bool				=	False
		_a	:  jnp.dtype				=	jnp.floataa
		def 	UpperCAmelCase__				(			self						) ->       Dict:




									"""simple docstring"""





									_UpperCAmelCase 		=			[
									    FlaxResnetBlockaD(
									        in_channels=self.in_channels			,    out_channels=self.in_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
									]

									_UpperCAmelCase 		=			[]

									for _ in range(self.num_layers						):
																_UpperCAmelCase 		=			FlaxTransformeraDModel(
																    in_channels=self.in_channels			,    n_heads=self.num_attention_heads			,    d_head=self.in_channels // self.num_attention_heads			,    depth=1			,    use_linear_projection=self.use_linear_projection			,    use_memory_efficient_attention=self.use_memory_efficient_attention			,    dtype=self.dtype			,    )
																attentions.append(UpperCAmelCase_						)

																_UpperCAmelCase 		=			FlaxResnetBlockaD(
																    in_channels=self.in_channels			,    out_channels=self.in_channels			,    dropout_prob=self.dropout			,    dtype=self.dtype			,    )
																resnets.append(UpperCAmelCase_						)

									_UpperCAmelCase 		=			resnets
									_UpperCAmelCase 		=			attentions






		def __call__(			self			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE			,    _SCREAMING_SNAKE_CASE=True						) ->       Union[str, Any]:




									"""simple docstring"""





									_UpperCAmelCase 		=			self.resnets[0](UpperCAmelCase_			,    UpperCAmelCase_						)
									for attn, resnet in zip(self.attentions			,    self.resnets[1:]						):
																_UpperCAmelCase 		=			attn(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)
																_UpperCAmelCase 		=			resnet(UpperCAmelCase_			,    UpperCAmelCase_			,    deterministic=UpperCAmelCase_						)

									return hidden_states


def 							_lowercase							(     )		->		Optional[int]:
					'''simple docstring'''


					SCREAMING_SNAKE_CASE__													= []
					SCREAMING_SNAKE_CASE__													= 1

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

					SCREAMING_SNAKE_CASE__													= ''.join(UpperCamelCase_		)

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


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





