'''simple docstring'''




import math

import torch
from torch import nn

from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin




class     a__      (   snake_case_							,   snake_case_ ):






     @register_to_config
     def __init__( self		:		List[Any]  ,				a		:		Any = 1_28  ,				a		:		Tuple = 2_56  ,				a		:		List[str] = 20_00.0  ,				a		:		Optional[int] = 7_68  ,				a		:		List[str] = 12  ,				a		:		Dict = 12  ,				a		:		Optional[Any] = 64  ,				a		:		Union[str, Any] = 20_48  ,				a		:		Any = 0.1  ,				):





         """simple docstring"""



         super().__init__()

         __lowerCamelCase		=  nn.Sequential(
             nn.Linear(a  ,				d_model * 4  ,				bias=a    )  ,				nn.SiLU()  ,				nn.Linear(d_model * 4  ,				d_model * 4  ,				bias=a    )  ,				nn.SiLU()  ,				)

         __lowerCamelCase		=  nn.Embedding(a  ,				a    )
         __lowerCamelCase		=  False

         __lowerCamelCase		=  nn.Linear(a  ,				a  ,				bias=a    )

         __lowerCamelCase		=  nn.Dropout(p=a    )

         __lowerCamelCase		=  nn.ModuleList()
         for lyr_num in range(a    ):
             # FiLM conditional T5 decoder
             __lowerCamelCase		=  DecoderLayer(d_model=a  ,				d_kv=a  ,				num_heads=a  ,				d_ff=a  ,				dropout_rate=a    )
             self.decoders.append(a    )

         __lowerCamelCase		=  TaLayerNorm(a    )

         __lowerCamelCase		=  nn.Dropout(p=a    )
         __lowerCamelCase		=  nn.Linear(a  ,				a  ,				bias=a    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		Tuple  ,				a		:		Optional[Any]  ,				a		:		Any    ):





         """simple docstring"""



         __lowerCamelCase		=  torch.mul(query_input.unsqueeze(-1    )  ,				key_input.unsqueeze(-2    )    )
         return mask.unsqueeze(-3    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		Optional[Any]  ,				a		:		Dict  ,				a		:		Any  ,				a		:		Tuple    ):





         """simple docstring"""



         __lowerCamelCase	,  __lowerCamelCase	,  __lowerCamelCase		=  decoder_input_tokens.shape
         assert decoder_noise_time.shape == (batch,)

         # decoder_noise_time is in [0, 1), so rescale to expected timing range.
         __lowerCamelCase		=  get_timestep_embedding(
             decoder_noise_time * self.config.max_decoder_noise_time  ,				embedding_dim=self.config.d_model  ,				max_period=self.config.max_decoder_noise_time  ,				).to(dtype=self.dtype    )

         __lowerCamelCase		=  self.conditioning_emb(a    ).unsqueeze(1    )

         assert conditioning_emb.shape == (batch, 1, self.config.d_model * 4)

         __lowerCamelCase		=  decoder_input_tokens.shape[1]

         # If we want to use relative positions for audio context, we can just offset
         # this sequence by the length of encodings_and_masks.
         __lowerCamelCase		=  torch.broadcast_to(
             torch.arange(a  ,				device=decoder_input_tokens.device    )  ,				(batch, seq_length)  ,				)

         __lowerCamelCase		=  self.position_encoding(a    )

         __lowerCamelCase		=  self.continuous_inputs_projection(a    )
         inputs += position_encodings
         __lowerCamelCase		=  self.dropout(a    )

         # decoder: No padding present.
         __lowerCamelCase		=  torch.ones(
             decoder_input_tokens.shape[:2]  ,				device=decoder_input_tokens.device  ,				dtype=inputs.dtype    )

         # Translate encoding masks to encoder-decoder masks.
         __lowerCamelCase		=  [(x, self.encoder_decoder_mask(a  ,				a    )) for x, y in encodings_and_masks]

         # cross attend style: concat encodings
         __lowerCamelCase		=  torch.cat([x[0] for x in encodings_and_encdec_masks]  ,				dim=1    )
         __lowerCamelCase		=  torch.cat([x[1] for x in encodings_and_encdec_masks]  ,				dim=-1    )

         for lyr in self.decoders:
             __lowerCamelCase		=  lyr(
                 a  ,				conditioning_emb=a  ,				encoder_hidden_states=a  ,				encoder_attention_mask=a  ,				)[0]

         __lowerCamelCase		=  self.decoder_norm(a    )
         __lowerCamelCase		=  self.post_dropout(a    )

         __lowerCamelCase		=  self.spec_out(a    )
         return spec_out




class     a__      (   nn.Module ):






     def __init__( self		:		Tuple  ,				a		:		List[str]  ,				a		:		List[str]  ,				a		:		Any  ,				a		:		Optional[int]  ,				a		:		List[Any]  ,				a		:		Tuple=1e-6    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  nn.ModuleList()

         # cond self attention: layer 0
         self.layer.append(
             TaLayerSelfAttentionCond(d_model=a  ,				d_kv=a  ,				num_heads=a  ,				dropout_rate=a    )    )

         # cross attention: layer 1
         self.layer.append(
             TaLayerCrossAttention(
                 d_model=a  ,				d_kv=a  ,				num_heads=a  ,				dropout_rate=a  ,				layer_norm_epsilon=a  ,				)    )

         # Film Cond MLP + dropout: last layer
         self.layer.append(
             TaLayerFFCond(d_model=a  ,				d_ff=a  ,				dropout_rate=a  ,				layer_norm_epsilon=a    )    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		Any  ,				a		:		int  ,				a		:		Any=None  ,				a		:		List[Any]=None  ,				a		:		List[Any]=None  ,				a		:		Union[str, Any]=None  ,				a		:		Optional[int]=None  ,				):





         """simple docstring"""



         __lowerCamelCase		=  self.layer[0](
             a  ,				conditioning_emb=a  ,				attention_mask=a  ,				)

         if encoder_hidden_states is not None:
             __lowerCamelCase		=  torch.where(encoder_attention_mask > 0  ,				0  ,				-1e1_0    ).to(
                 encoder_hidden_states.dtype    )

             __lowerCamelCase		=  self.layer[1](
                 a  ,				key_value_states=a  ,				attention_mask=a  ,				)

         # Apply Film Conditional Feed Forward layer
         __lowerCamelCase		=  self.layer[-1](a  ,				a    )

         return (hidden_states,)




class     a__      (   nn.Module ):






     def __init__( self		:		str  ,				a		:		List[Any]  ,				a		:		Optional[Any]  ,				a		:		Tuple  ,				a		:		Optional[Any]    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  TaLayerNorm(a    )
         __lowerCamelCase		=  TaFiLMLayer(in_features=d_model * 4  ,				out_features=a    )
         __lowerCamelCase		=  Attention(query_dim=a  ,				heads=a  ,				dim_head=a  ,				out_bias=a  ,				scale_qk=a    )
         __lowerCamelCase		=  nn.Dropout(a    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		Optional[int]  ,				a		:		List[str]  ,				a		:		List[str]=None  ,				a		:		Tuple=None  ,				):





         """simple docstring"""



         __lowerCamelCase		=  self.layer_norm(a    )

         if conditioning_emb is not None:
             __lowerCamelCase		=  self.FiLMLayer(a  ,				a    )

         # Self-attention block
         __lowerCamelCase		=  self.attention(a    )

         __lowerCamelCase		=  hidden_states + self.dropout(a    )

         return hidden_states




class     a__      (   nn.Module ):






     def __init__( self		:		int  ,				a		:		str  ,				a		:		str  ,				a		:		Dict  ,				a		:		Any  ,				a		:		List[str]    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  Attention(query_dim=a  ,				heads=a  ,				dim_head=a  ,				out_bias=a  ,				scale_qk=a    )
         __lowerCamelCase		=  TaLayerNorm(a  ,				eps=a    )
         __lowerCamelCase		=  nn.Dropout(a    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		List[str]  ,				a		:		Union[str, Any]  ,				a		:		Union[str, Any]=None  ,				a		:		Union[str, Any]=None  ,				):





         """simple docstring"""



         __lowerCamelCase		=  self.layer_norm(a    )
         __lowerCamelCase		=  self.attention(
             a  ,				encoder_hidden_states=a  ,				attention_mask=attention_mask.squeeze(1    )  ,				)
         __lowerCamelCase		=  hidden_states + self.dropout(a    )
         return layer_output




class     a__      (   nn.Module ):






     def __init__( self		:		str  ,				a		:		List[str]  ,				a		:		int  ,				a		:		Tuple  ,				a		:		Tuple    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  TaDenseGatedActDense(d_model=a  ,				d_ff=a  ,				dropout_rate=a    )
         __lowerCamelCase		=  TaFiLMLayer(in_features=d_model * 4  ,				out_features=a    )
         __lowerCamelCase		=  TaLayerNorm(a  ,				eps=a    )
         __lowerCamelCase		=  nn.Dropout(a    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		Tuple  ,				a		:		Any  ,				a		:		List[str]=None    ):





         """simple docstring"""



         __lowerCamelCase		=  self.layer_norm(a    )
         if conditioning_emb is not None:
             __lowerCamelCase		=  self.film(a  ,				a    )

         __lowerCamelCase		=  self.DenseReluDense(a    )
         __lowerCamelCase		=  hidden_states + self.dropout(a    )
         return hidden_states




class     a__      (   nn.Module ):






     def __init__( self		:		Optional[Any]  ,				a		:		int  ,				a		:		List[Any]  ,				a		:		Optional[Any]    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  nn.Linear(a  ,				a  ,				bias=a    )
         __lowerCamelCase		=  nn.Linear(a  ,				a  ,				bias=a    )
         __lowerCamelCase		=  nn.Linear(a  ,				a  ,				bias=a    )
         __lowerCamelCase		=  nn.Dropout(a    )
         __lowerCamelCase		=  NewGELUActivation()






     def    SCREAMING_SNAKE_CASE__   ( self		:		Union[str, Any]  ,				a		:		List[str]    ):





         """simple docstring"""



         __lowerCamelCase		=  self.act(self.wi_a(a    )    )
         __lowerCamelCase		=  self.wi_a(a    )
         __lowerCamelCase		=  hidden_gelu * hidden_linear
         __lowerCamelCase		=  self.dropout(a    )

         __lowerCamelCase		=  self.wo(a    )
         return hidden_states




class     a__      (   nn.Module ):






     def __init__( self		:		Union[str, Any]  ,				a		:		Union[str, Any]  ,				a		:		Optional[int]=1e-6    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  nn.Parameter(torch.ones(a    )    )
         __lowerCamelCase		=  eps






     def    SCREAMING_SNAKE_CASE__   ( self		:		Optional[int]  ,				a		:		Tuple    ):





         """simple docstring"""



         __lowerCamelCase		=  hidden_states.to(torch.floataa    ).pow(2    ).mean(-1  ,				keepdim=a    )
         __lowerCamelCase		=  hidden_states * torch.rsqrt(variance + self.variance_epsilon    )

         # convert into half-precision if necessary
         if self.weight.dtype in [torch.floataa, torch.bfloataa]:
             __lowerCamelCase		=  hidden_states.to(self.weight.dtype    )

         return self.weight * hidden_states




class     a__      (   nn.Module ):






     def    SCREAMING_SNAKE_CASE__   ( self		:		Union[str, Any]  ,				a		:		Any    ):





         """simple docstring"""



         return 0.5 * input * (1.0 + torch.tanh(math.sqrt(2.0 / math.pi    ) * (input + 0.04_47_15 * torch.pow(a  ,				3.0    ))    ))




class     a__      (   nn.Module ):






     def __init__( self		:		Any  ,				a		:		str  ,				a		:		Dict    ):





         """simple docstring"""



         super().__init__()
         __lowerCamelCase		=  nn.Linear(a  ,				out_features * 2  ,				bias=a    )






     def    SCREAMING_SNAKE_CASE__   ( self		:		List[str]  ,				a		:		Optional[Any]  ,				a		:		str    ):





         """simple docstring"""



         __lowerCamelCase		=  self.scale_bias(a    )
         __lowerCamelCase	,  __lowerCamelCase		=  torch.chunk(a  ,				2  ,				-1    )
         __lowerCamelCase		=  x * (1 + scale) + shift
         return x


import math





def 			lowerCamelCase_ (				lowerCamelCase__	, lowerCamelCase__    ):
				if 0 not in (x, y):
								# We use the relation x^y = y*log10(x), where 10 is the base.
								return y * math.logaa(lowerCamelCase__    )
				else:
								if x == 0:  # 0 raised to any number is 0
												return 0
								elif y == 0:
												return 1  # any number raised to 0 is 1
				raise AssertionError("This should never happen"    )


if __name__ == "__main__":  # Main function
			# Read two numbers from input and typecast them to int using map function.
			# Here x is the base and y is the power.
			__A				='''Enter the base and the power separated by a comma: '''
			__A,						__A				=map(int, input(prompt).split(''','''))
			__A,						__A				=map(int, input(prompt).split(''','''))

			# We find the log of each number, using the function res(), which takes two
			# arguments.
			__A				=res(xa, ya)
			__A				=res(xa, ya)

			# We check for the largest number
			if resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			elif resa > resa:
						print('''Largest number is''', xa, '''^''', ya)
			else:
						print('''Both are equal''')


