



"""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 			__snake_case			(      nn.Module):
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  float         =		0.0
  snake_case__							:  int         =		1
  snake_case__							:  int         =		1
  snake_case__							:  bool         =		True
  snake_case__							:  bool         =		False
  snake_case__							:  bool         =		False
  snake_case__							:  bool         =		False
  snake_case__							:  jnp.dtype         =		jnp.floataa




  def 		SCREAMING_SNAKE_CASE							(					self	:		Tuple						):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					[]
         _lowerCamelCase		:							Optional[Any]            =					[]

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

                _lowerCamelCase		:							Union[str, Any]            =					FlaxResnetBlockaD(
                    in_channels=__lowerCAmelCase		,   out_channels=self.out_channels		,   dropout_prob=self.dropout		,   dtype=self.dtype		,   )
                resnets.append(__lowerCAmelCase						)

                _lowerCamelCase		:							List[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		:							Optional[Any]            =					resnets
         _lowerCamelCase		:							List[Any]            =					attentions

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




  def __call__(					self	:		str		,   __lowerCAmelCase	:		Dict		,   __lowerCAmelCase	:		str		,   __lowerCAmelCase	:		Any		,   __lowerCAmelCase	:		List[Any]=True						):






         """simple docstring"""






         _lowerCamelCase		:							List[Any]            =					()

         for resnet, attn in zip(self.resnets		,   self.attentions						):
                _lowerCamelCase		:							Optional[int]            =					resnet(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)
                _lowerCamelCase		:							str            =					attn(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)
                output_states += (hidden_states,)

         if self.add_downsample:
                _lowerCamelCase		:							Optional[Any]            =					self.downsamplers_a(__lowerCAmelCase						)
                output_states += (hidden_states,)

         return hidden_states, output_states






class 			__snake_case			(      nn.Module):
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  float         =		0.0
  snake_case__							:  int         =		1
  snake_case__							:  bool         =		True
  snake_case__							:  jnp.dtype         =		jnp.floataa




  def 		SCREAMING_SNAKE_CASE							(					self	:		Union[str, Any]						):






         """simple docstring"""






         _lowerCamelCase		:							Optional[int]            =					[]

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

                _lowerCamelCase		:							Union[str, Any]            =					FlaxResnetBlockaD(
                    in_channels=__lowerCAmelCase		,   out_channels=self.out_channels		,   dropout_prob=self.dropout		,   dtype=self.dtype		,   )
                resnets.append(__lowerCAmelCase						)
         _lowerCamelCase		:							Dict            =					resnets

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




  def __call__(					self	:		str		,   __lowerCAmelCase	:		List[Any]		,   __lowerCAmelCase	:		Optional[Any]		,   __lowerCAmelCase	:		Tuple=True						):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					()

         for resnet in self.resnets:
                _lowerCamelCase		:							int            =					resnet(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)
                output_states += (hidden_states,)

         if self.add_downsample:
                _lowerCamelCase		:							Union[str, Any]            =					self.downsamplers_a(__lowerCAmelCase						)
                output_states += (hidden_states,)

         return hidden_states, output_states






class 			__snake_case			(      nn.Module):
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  float         =		0.0
  snake_case__							:  int         =		1
  snake_case__							:  int         =		1
  snake_case__							:  bool         =		True
  snake_case__							:  bool         =		False
  snake_case__							:  bool         =		False
  snake_case__							:  bool         =		False
  snake_case__							:  jnp.dtype         =		jnp.floataa




  def 		SCREAMING_SNAKE_CASE							(					self	:		List[Any]						):






         """simple docstring"""






         _lowerCamelCase		:							Optional[int]            =					[]
         _lowerCamelCase		:							List[str]            =					[]

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

                _lowerCamelCase		:							Any            =					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		:							Dict            =					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		:							Optional[Any]            =					attentions

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




  def __call__(					self	:		List[Any]		,   __lowerCAmelCase	:		List[Any]		,   __lowerCAmelCase	:		List[Any]		,   __lowerCAmelCase	:		Tuple		,   __lowerCAmelCase	:		Dict		,   __lowerCAmelCase	:		Any=True						):






         """simple docstring"""






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

                _lowerCamelCase		:							List[str]            =					resnet(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)
                _lowerCamelCase		:							Tuple            =					attn(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)

         if self.add_upsample:
                _lowerCamelCase		:							List[Any]            =					self.upsamplers_a(__lowerCAmelCase						)

         return hidden_states






class 			__snake_case			(      nn.Module):
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  int
  snake_case__							:  float         =		0.0
  snake_case__							:  int         =		1
  snake_case__							:  bool         =		True
  snake_case__							:  jnp.dtype         =		jnp.floataa




  def 		SCREAMING_SNAKE_CASE							(					self	:		int						):






         """simple docstring"""






         _lowerCamelCase		:							Dict            =					[]

         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		:							Union[str, Any]            =					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		:							Tuple            =					resnets

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




  def __call__(					self	:		Any		,   __lowerCAmelCase	:		int		,   __lowerCAmelCase	:		Optional[Any]		,   __lowerCAmelCase	:		List[str]		,   __lowerCAmelCase	:		Optional[Any]=True						):






         """simple docstring"""






         for resnet in self.resnets:
                # pop res hidden states
                _lowerCamelCase		:							Tuple            =					res_hidden_states_tuple[-1]
                _lowerCamelCase		:							Union[str, Any]            =					res_hidden_states_tuple[:-1]
                _lowerCamelCase		:							List[Any]            =					jnp.concatenate((hidden_states, res_hidden_states)		,   axis=-1						)

                _lowerCamelCase		:							List[Any]            =					resnet(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)

         if self.add_upsample:
                _lowerCamelCase		:							int            =					self.upsamplers_a(__lowerCAmelCase						)

         return hidden_states






class 			__snake_case			(      nn.Module):
  snake_case__							:  int
  snake_case__							:  float         =		0.0
  snake_case__							:  int         =		1
  snake_case__							:  int         =		1
  snake_case__							:  bool         =		False
  snake_case__							:  bool         =		False
  snake_case__							:  jnp.dtype         =		jnp.floataa




  def 		SCREAMING_SNAKE_CASE							(					self	:		List[str]						):






         """simple docstring"""






         _lowerCamelCase		:							List[Any]            =					[
             FlaxResnetBlockaD(
                 in_channels=self.in_channels		,   out_channels=self.in_channels		,   dropout_prob=self.dropout		,   dtype=self.dtype		,   )
         ]

         _lowerCamelCase		:							Dict            =					[]

         for _ in range(self.num_layers						):
                _lowerCamelCase		:							int            =					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		:							Union[str, Any]            =					FlaxResnetBlockaD(
                    in_channels=self.in_channels		,   out_channels=self.in_channels		,   dropout_prob=self.dropout		,   dtype=self.dtype		,   )
                resnets.append(__lowerCAmelCase						)

         _lowerCamelCase		:							Any            =					resnets
         _lowerCamelCase		:							Tuple            =					attentions




  def __call__(					self	:		Any		,   __lowerCAmelCase	:		Optional[Any]		,   __lowerCAmelCase	:		Union[str, Any]		,   __lowerCAmelCase	:		Union[str, Any]		,   __lowerCAmelCase	:		List[Any]=True						):






         """simple docstring"""






         _lowerCamelCase		:							int            =					self.resnets[0](__lowerCAmelCase		,   __lowerCAmelCase						)
         for attn, resnet in zip(self.attentions		,   self.resnets[1:]						):
                _lowerCamelCase		:							Any            =					attn(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)
                _lowerCamelCase		:							Tuple            =					resnet(__lowerCAmelCase		,   __lowerCAmelCase		,   deterministic=__lowerCAmelCase						)

         return hidden_states






import requests
from bsa import BeautifulSoup
def 							UpperCamelCase_(					_A :str = "AAPL"	)->		str:
			UpperCamelCase__       =							F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
			UpperCamelCase__       =							BeautifulSoup(requests.get(_A	).text					,  "html.parser"	)
			UpperCamelCase__       =							"My(6px) Pos(r) smartphone_Mt(6px)"
			return soup.find("div"					,  class_=class_	).find("span"	).text


if __name__ == "__main__":
						for symbol in "AAPL AMZN IBM GOOG MSFT ORCL".split():
												print(f'''Current {symbol:<4} stock price is {stock_price(symbol):>8}''')


