



"""simple docstring"""






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

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

class  __SCREAMING_SNAKE_CASE			(   nn.Module     ):


					'''simple docstring'''





					_a         =							42
					_a         =							42
					_a         =							0.0
					_a         =							1
					_a         =							1
					_a         =							True
					_a         =							False
					_a         =							False
					_a         =							False
					_a         =							jnp.floataa



					def 	snake_case ( self							:						Dict  )->      Optional[int]:
								lowerCamelCase__	:	str				=[]
								lowerCamelCase__	:	List[str]				=[]

								for i in range(self.num_layers  ):
											lowerCamelCase__	:	List[str]				=self.in_channels if i == 0 else self.out_channels

											lowerCamelCase__	:	int				=FlaxResnetBlockaD(
											    in_channels=lowerCamelCase,						out_channels=self.out_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
											resnets.append(lowerCamelCase  )

											lowerCamelCase__	:	List[Any]				=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(lowerCamelCase  )

								lowerCamelCase__	:	Optional[Any]				=resnets
								lowerCamelCase__	:	Tuple				=attentions

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




					def __call__( self							:						int,						lowerCamelCase							:						Optional[int],						lowerCamelCase							:						str,						lowerCamelCase							:						Optional[int],						lowerCamelCase							:						Optional[Any]=True  )->      Tuple:
								lowerCamelCase__	:	Optional[Any]				=()

								for resnet, attn in zip(self.resnets,						self.attentions  ):
											lowerCamelCase__	:	str				=resnet(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )
											lowerCamelCase__	:	Any				=attn(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )
											output_states += (hidden_states,)

								if self.add_downsample:
											lowerCamelCase__	:	List[Any]				=self.downsamplers_a(lowerCamelCase  )
											output_states += (hidden_states,)

								return hidden_states, output_states





class  __SCREAMING_SNAKE_CASE			(   nn.Module     ):


					'''simple docstring'''





					_a         =							42
					_a         =							42
					_a         =							0.0
					_a         =							1
					_a         =							True
					_a         =							jnp.floataa



					def 	snake_case ( self							:						int  )->      int:
								lowerCamelCase__	:	List[str]				=[]

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

											lowerCamelCase__	:	Tuple				=FlaxResnetBlockaD(
											    in_channels=lowerCamelCase,						out_channels=self.out_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
											resnets.append(lowerCamelCase  )
								lowerCamelCase__	:	List[str]				=resnets

								if self.add_downsample:
											lowerCamelCase__	:	List[Any]				=FlaxDownsampleaD(self.out_channels,						dtype=self.dtype  )




					def __call__( self							:						Union[str, Any],						lowerCamelCase							:						Tuple,						lowerCamelCase							:						Optional[int],						lowerCamelCase							:						Union[str, Any]=True  )->      Optional[int]:
								lowerCamelCase__	:	Union[str, Any]				=()

								for resnet in self.resnets:
											lowerCamelCase__	:	Tuple				=resnet(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )
											output_states += (hidden_states,)

								if self.add_downsample:
											lowerCamelCase__	:	List[Any]				=self.downsamplers_a(lowerCamelCase  )
											output_states += (hidden_states,)

								return hidden_states, output_states





class  __SCREAMING_SNAKE_CASE			(   nn.Module     ):


					'''simple docstring'''





					_a         =							42
					_a         =							42
					_a         =							42
					_a         =							0.0
					_a         =							1
					_a         =							1
					_a         =							True
					_a         =							False
					_a         =							False
					_a         =							False
					_a         =							jnp.floataa



					def 	snake_case ( self							:						Tuple  )->      Tuple:
								lowerCamelCase__	:	Any				=[]
								lowerCamelCase__	:	Optional[int]				=[]

								for i in range(self.num_layers  ):
											lowerCamelCase__	:	Optional[int]				=self.in_channels if (i == self.num_layers - 1) else self.out_channels
											lowerCamelCase__	:	Optional[int]				=self.prev_output_channel if i == 0 else self.out_channels

											lowerCamelCase__	:	int				=FlaxResnetBlockaD(
											    in_channels=resnet_in_channels + res_skip_channels,						out_channels=self.out_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
											resnets.append(lowerCamelCase  )

											lowerCamelCase__	:	str				=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(lowerCamelCase  )

								lowerCamelCase__	:	Union[str, Any]				=resnets
								lowerCamelCase__	:	List[Any]				=attentions

								if self.add_upsample:
											lowerCamelCase__	:	Optional[int]				=FlaxUpsampleaD(self.out_channels,						dtype=self.dtype  )




					def __call__( self							:						List[str],						lowerCamelCase							:						Dict,						lowerCamelCase							:						Union[str, Any],						lowerCamelCase							:						Union[str, Any],						lowerCamelCase							:						Tuple,						lowerCamelCase							:						Dict=True  )->      Optional[int]:
								for resnet, attn in zip(self.resnets,						self.attentions  ):
											# pop res hidden states
											lowerCamelCase__	:	str				=res_hidden_states_tuple[-1]
											lowerCamelCase__	:	Union[str, Any]				=res_hidden_states_tuple[:-1]
											lowerCamelCase__	:	List[str]				=jnp.concatenate((hidden_states, res_hidden_states),						axis=-1  )

											lowerCamelCase__	:	Union[str, Any]				=resnet(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )
											lowerCamelCase__	:	str				=attn(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )

								if self.add_upsample:
											lowerCamelCase__	:	Any				=self.upsamplers_a(lowerCamelCase  )

								return hidden_states





class  __SCREAMING_SNAKE_CASE			(   nn.Module     ):


					'''simple docstring'''





					_a         =							42
					_a         =							42
					_a         =							42
					_a         =							0.0
					_a         =							1
					_a         =							True
					_a         =							jnp.floataa



					def 	snake_case ( self							:						Any  )->      str:
								lowerCamelCase__	:	Optional[int]				=[]

								for i in range(self.num_layers  ):
											lowerCamelCase__	:	Any				=self.in_channels if (i == self.num_layers - 1) else self.out_channels
											lowerCamelCase__	:	List[Any]				=self.prev_output_channel if i == 0 else self.out_channels

											lowerCamelCase__	:	Tuple				=FlaxResnetBlockaD(
											    in_channels=resnet_in_channels + res_skip_channels,						out_channels=self.out_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
											resnets.append(lowerCamelCase  )

								lowerCamelCase__	:	int				=resnets

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




					def __call__( self							:						Optional[Any],						lowerCamelCase							:						Optional[Any],						lowerCamelCase							:						Union[str, Any],						lowerCamelCase							:						Union[str, Any],						lowerCamelCase							:						Tuple=True  )->      List[Any]:
								for resnet in self.resnets:
											# pop res hidden states
											lowerCamelCase__	:	Optional[int]				=res_hidden_states_tuple[-1]
											lowerCamelCase__	:	Optional[Any]				=res_hidden_states_tuple[:-1]
											lowerCamelCase__	:	List[Any]				=jnp.concatenate((hidden_states, res_hidden_states),						axis=-1  )

											lowerCamelCase__	:	Any				=resnet(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )

								if self.add_upsample:
											lowerCamelCase__	:	List[str]				=self.upsamplers_a(lowerCamelCase  )

								return hidden_states





class  __SCREAMING_SNAKE_CASE			(   nn.Module     ):


					'''simple docstring'''





					_a         =							42
					_a         =							0.0
					_a         =							1
					_a         =							1
					_a         =							False
					_a         =							False
					_a         =							jnp.floataa



					def 	snake_case ( self							:						Any  )->      Union[str, Any]:
								# there is always at least one resnet
								lowerCamelCase__	:	Any				=[
								    FlaxResnetBlockaD(
								        in_channels=self.in_channels,						out_channels=self.in_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
								]

								lowerCamelCase__	:	int				=[]

								for _ in range(self.num_layers  ):
											lowerCamelCase__	:	Union[str, Any]				=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(lowerCamelCase  )

											lowerCamelCase__	:	str				=FlaxResnetBlockaD(
											    in_channels=self.in_channels,						out_channels=self.in_channels,						dropout_prob=self.dropout,						dtype=self.dtype,						)
											resnets.append(lowerCamelCase  )

								lowerCamelCase__	:	str				=resnets
								lowerCamelCase__	:	Optional[Any]				=attentions




					def __call__( self							:						Union[str, Any],						lowerCamelCase							:						str,						lowerCamelCase							:						int,						lowerCamelCase							:						Optional[int],						lowerCamelCase							:						Union[str, Any]=True  )->      List[Any]:
								lowerCamelCase__	:	Any				=self.resnets[0](lowerCamelCase,						lowerCamelCase  )
								for attn, resnet in zip(self.attentions,						self.resnets[1:]  ):
											lowerCamelCase__	:	List[Any]				=attn(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )
											lowerCamelCase__	:	str				=resnet(lowerCamelCase,						lowerCamelCase,						deterministic=lowerCamelCase  )

								return hidden_states









"""simple docstring"""






def   snake_case__     (	__lowerCamelCase       :					int = 4000000			):
			"""simple docstring"""
			lowerCamelCase__	:	Dict				=[]
			lowerCamelCase__			,     lowerCamelCase__	:	Union[str, Any]				=0, 1
			while b <= n:
						if b % 2 == 0:
									even_fibs.append(__lowerCamelCase			)
						lowerCamelCase__			,     lowerCamelCase__	:	Union[str, Any]				=b, a + b
			return sum(__lowerCamelCase			)


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




