"""simple docstring"""
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory

from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available
from transformers.models.bert.tokenization_bert import BertTokenizer
from transformers.testing_utils import require_tensorflow_text, require_tf, slow


if is_tf_available():
       import tensorflow as tf

if is_tensorflow_text_available():
       from transformers.models.bert import TFBertTokenizer


lowercase__ 	=     ['bert-base-uncased', 'bert-base-cased']
lowercase__ 	=     'hf-internal-testing/tiny-bert-tf-only'

if is_tf_available():




       class        __snake_case	(					tf.keras.Model    ):



             def __init__(						self   ,      lowercase)     ->      Tuple:





               '''simple docstring'''





               super().__init__()
               a__:					Tuple      							=     tokenizer
               a__:					Union[str, Any]      							=     AutoConfig.from_pretrained(lowercase)
               a__:					Any      							=     TFAutoModel.from_config(lowercase)



             def   lowerCamelCase_       (						self   ,      lowercase)     ->      Dict:





               '''simple docstring'''





               a__:					Dict      							=     self.tokenizer(lowercase)
               a__:					Any      							=     self.bert(**lowercase)
               return out["pooler_output"]




@require_tf
@require_tensorflow_text
class        __snake_case	(					unittest.TestCase    ):



      def   lowerCamelCase_       (						self)     ->      Optional[Any]:





        '''simple docstring'''





        super().setUp()

        a__:					Dict      							=     [
            BertTokenizer.from_pretrained(lowercase) for checkpoint in (TOKENIZER_CHECKPOINTS * 2)
        ]  # repeat for when fast_bert_tokenizer=false
        a__:					int      							=     [TFBertTokenizer.from_pretrained(lowercase) for checkpoint in TOKENIZER_CHECKPOINTS] + [
            TFBertTokenizer.from_pretrained(lowercase   ,      use_fast_bert_tokenizer=lowercase)
            for checkpoint in TOKENIZER_CHECKPOINTS
        ]
        assert len(self.tokenizers) == len(self.tf_tokenizers)

        a__:					Union[str, Any]      							=     [
            'This is a straightforward English test sentence.',
            'This one has some weird characters\rto\nsee\r\nif  those\u00E9break things.',
            'Now we\'re going to add some Chinese: 一 二 三 一二三',
            'And some much more rare Chinese: 齉 堃 齉堃',
            'Je vais aussi écrire en français pour tester les accents',
            'Classical Irish also has some unusual characters, so in they go: Gaelaċ, ꝼ',
        ]
        a__:					int      							=     list(zip(self.test_sentences   ,      self.test_sentences[::-1]))



      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        for tokenizer, tf_tokenizer in zip(self.tokenizers   ,      self.tf_tokenizers):
          for test_inputs in (self.test_sentences, self.paired_sentences):
            a__:					List[Any]      							=     tokenizer(lowercase   ,      return_tensors='tf'   ,      padding='longest')
            a__:					Optional[Any]      							=     tf_tokenizer(lowercase)

            for key in python_outputs.keys():
              self.assertTrue(tf.reduce_all(python_outputs[key].shape == tf_outputs[key].shape))
              self.assertTrue(tf.reduce_all(tf.cast(python_outputs[key]   ,      tf.intaa) == tf_outputs[key]))



      @slow
      def   lowerCamelCase_       (						self)     ->      int:





        '''simple docstring'''





        for tf_tokenizer in self.tf_tokenizers:
          a__:					int      							=     tf_tokenizer(self.paired_sentences)
          a__:					List[Any]      							=     tf_tokenizer(
              text=[sentence[0] for sentence in self.paired_sentences]   ,      text_pair=[sentence[1] for sentence in self.paired_sentences]   ,      )
          for key in merged_outputs.keys():
            self.assertTrue(tf.reduce_all(tf.cast(merged_outputs[key]   ,      tf.intaa) == separated_outputs[key]))



      @slow
      def   lowerCamelCase_       (						self)     ->      Optional[Any]:





        '''simple docstring'''





        for tf_tokenizer in self.tf_tokenizers:
          a__:					Optional[int]      							=     tf.function(lowercase)
          for test_inputs in (self.test_sentences, self.paired_sentences):
            a__:					List[str]      							=     tf.constant(lowercase)
            a__:					Union[str, Any]      							=     compiled_tokenizer(lowercase)
            a__:					Any      							=     tf_tokenizer(lowercase)

            for key in eager_outputs.keys():
              self.assertTrue(tf.reduce_all(eager_outputs[key] == compiled_outputs[key]))



      @slow
      def   lowerCamelCase_       (						self)     ->      Dict:





        '''simple docstring'''





        for tf_tokenizer in self.tf_tokenizers:
          a__:					Dict      							=     ModelToSave(tokenizer=lowercase)
          a__:					Optional[int]      							=     tf.convert_to_tensor(self.test_sentences)
          a__:					Optional[int]      							=     model(lowercase)  # Build model with some sample inputs
          with TemporaryDirectory() as tempdir:
            a__:					Optional[int]      							=     Path(lowercase) / 'saved.model'
            model.save(lowercase)
            a__:					Union[str, Any]      							=     tf.keras.models.load_model(lowercase)
          a__:					List[Any]      							=     loaded_model(lowercase)
          # We may see small differences because the loaded model is compiled, so we need an epsilon for the test
          self.assertLessEqual(tf.reduce_max(tf.abs(out - loaded_output))   ,      1e-5)



"""simple docstring"""
import math







def 						__a       (     _SCREAMING_SNAKE_CASE		,					_SCREAMING_SNAKE_CASE       )     ->Optional[int]:
  if 0 not in (x, y):
    # We use the relation x^y = y*log10(x), where 10 is the base.
    return y * math.logaa(_SCREAMING_SNAKE_CASE       )
  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.
 lowercase__ 	=     'Enter the base and the power separated by a comma: '
 lowercase__	, lowercase__ 	=     map(int, input(prompt).split(','))
 lowercase__	, lowercase__ 	=     map(int, input(prompt).split(','))

 # We find the log of each number, using the function res(), which takes two
 # arguments.
 lowercase__ 	=     res(xa, ya)
 lowercase__ 	=     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')


