'''simple docstring'''




from __future__ import annotations

import unittest

from transformers import DebertaConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers import (
      TFDebertaForMaskedLM,
      TFDebertaForQuestionAnswering,
      TFDebertaForSequenceClassification,
      TFDebertaForTokenClassification,
      TFDebertaModel,
  )

class      lowerCamelCase_     :
      '''simple docstring'''

      def __init__(	self						:    List[Any]						, A						:    int						, A						:    List[str]=13						, A						:    Union[str, Any]=7						, A						:    Tuple=True						, A						:    Union[str, Any]=True						, A						:    Any=True						, A						:    int=True						, A						:    List[str]=99						, A						:    int=32						, A						:    Optional[int]=2						, A						:    Optional[Any]=4						, A						:    Dict=37						, A						:    str="gelu"						, A						:    Optional[Any]=0.1						, A						:    Union[str, Any]=0.1						, A						:    Dict=512						, A						:    Dict=16						, A						:    Any=2						, A						:    List[Any]=0.02						, A						:    str=3						, A						:    List[str]=4						, A						:    List[str]=None						, ):
             _UpperCAmelCase					:  Optional[int]											=   parent
             _UpperCAmelCase					:  Optional[int]											=   13
             _UpperCAmelCase					:  List[Any]											=   7
             _UpperCAmelCase					:  List[Any]											=   True
             _UpperCAmelCase					:  Optional[int]											=   True
             _UpperCAmelCase					:  Tuple											=   True
             _UpperCAmelCase					:  Dict											=   True
             _UpperCAmelCase					:  int											=   99
             _UpperCAmelCase					:  Union[str, Any]											=   32
             _UpperCAmelCase					:  Dict											=   2
             _UpperCAmelCase					:  List[str]											=   4
             _UpperCAmelCase					:  Union[str, Any]											=   37
             _UpperCAmelCase					:  Union[str, Any]											=   "gelu"
             _UpperCAmelCase					:  Tuple											=   0.1
             _UpperCAmelCase					:  List[str]											=   0.1
             _UpperCAmelCase					:  Optional[int]											=   512
             _UpperCAmelCase					:  Union[str, Any]											=   16
             _UpperCAmelCase					:  Optional[int]											=   False
             _UpperCAmelCase					:  str											=   -1
             _UpperCAmelCase					:  List[Any]											=   True
             _UpperCAmelCase					:  Union[str, Any]											=   2
             _UpperCAmelCase					:  Tuple											=   0.02
             _UpperCAmelCase					:  Tuple											=   3
             _UpperCAmelCase					:  Union[str, Any]											=   4
             _UpperCAmelCase					:  Optional[Any]											=   None




      def 					_A     (	self						:    Any	):
             _UpperCAmelCase					:  Optional[Any]											=   ids_tensor([self.batch_size, self.seq_length]						, self.vocab_size	)

             _UpperCAmelCase					:  Dict											=   None
             if self.use_input_mask:
                    _UpperCAmelCase					:  List[str]											=   random_attention_mask([self.batch_size, self.seq_length]	)

             _UpperCAmelCase					:  Optional[Any]											=   None
             if self.use_token_type_ids:
                    _UpperCAmelCase					:  Any											=   ids_tensor([self.batch_size, self.seq_length]						, self.type_vocab_size	)

             _UpperCAmelCase					:  Tuple											=   None
             _UpperCAmelCase					:  List[str]											=   None
             _UpperCAmelCase					:  str											=   None
             if self.use_labels:
                    _UpperCAmelCase					:  str											=   ids_tensor([self.batch_size]						, self.type_sequence_label_size	)
                    _UpperCAmelCase					:  Dict											=   ids_tensor([self.batch_size, self.seq_length]						, self.num_labels	)

             _UpperCAmelCase					:  List[Any]											=   DebertaConfig(
                 vocab_size=self.vocab_size						, hidden_size=self.hidden_size						, num_hidden_layers=self.num_hidden_layers						, num_attention_heads=self.num_attention_heads						, intermediate_size=self.intermediate_size						, hidden_act=self.hidden_act						, hidden_dropout_prob=self.hidden_dropout_prob						, attention_probs_dropout_prob=self.attention_probs_dropout_prob						, max_position_embeddings=self.max_position_embeddings						, type_vocab_size=self.type_vocab_size						, relative_attention=self.relative_attention						, max_relative_positions=self.max_relative_positions						, position_biased_input=self.position_biased_input						, initializer_range=self.initializer_range						, return_dict=A						, )

             return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




      def 					_A     (	self						:    Optional[Any]						, A						:    Optional[int]						, A						:    List[Any]						, A						:    Dict						, A						:    Optional[Any]						, A						:    Union[str, Any]						, A						:    int						, A						:    Tuple	):
             _UpperCAmelCase					:  List[str]											=   TFDebertaModel(config=A	)
             _UpperCAmelCase					:  List[str]											=   {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

             _UpperCAmelCase					:  Optional[Any]											=   [input_ids, input_mask]
             _UpperCAmelCase					:  int											=   model(A	)

             _UpperCAmelCase					:  Tuple											=   model(A	)

             self.parent.assertEqual(result.last_hidden_state.shape						, (self.batch_size, self.seq_length, self.hidden_size)	)




      def 					_A     (	self						:    Any						, A						:    List[str]						, A						:    List[str]						, A						:    List[str]						, A						:    List[Any]						, A						:    Optional[Any]						, A						:    Union[str, Any]						, A						:    int	):
             _UpperCAmelCase					:  List[Any]											=   TFDebertaForMaskedLM(config=A	)
             _UpperCAmelCase					:  Any											=   {
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }
             _UpperCAmelCase					:  List[Any]											=   model(A	)
             self.parent.assertEqual(result.logits.shape						, (self.batch_size, self.seq_length, self.vocab_size)	)




      def 					_A     (	self						:    str						, A						:    Tuple						, A						:    List[Any]						, A						:    Any						, A						:    List[Any]						, A						:    Any						, A						:    Dict						, A						:    Union[str, Any]	):
             _UpperCAmelCase					:  List[str]											=   self.num_labels
             _UpperCAmelCase					:  Any											=   TFDebertaForSequenceClassification(config=A	)
             _UpperCAmelCase					:  Tuple											=   {
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }

             _UpperCAmelCase					:  Dict											=   model(A	)
             self.parent.assertEqual(result.logits.shape						, (self.batch_size, self.num_labels)	)




      def 					_A     (	self						:    int						, A						:    Tuple						, A						:    str						, A						:    List[str]						, A						:    str						, A						:    Any						, A						:    List[str]						, A						:    Dict	):
             _UpperCAmelCase					:  str											=   self.num_labels
             _UpperCAmelCase					:  str											=   TFDebertaForTokenClassification(config=A	)
             _UpperCAmelCase					:  Any											=   {
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }
             _UpperCAmelCase					:  Dict											=   model(A	)
             self.parent.assertEqual(result.logits.shape						, (self.batch_size, self.seq_length, self.num_labels)	)




      def 					_A     (	self						:    int						, A						:    int						, A						:    List[str]						, A						:    Dict						, A						:    int						, A						:    List[str]						, A						:    str						, A						:    Optional[int]	):
             _UpperCAmelCase					:  int											=   TFDebertaForQuestionAnswering(config=A	)
             _UpperCAmelCase					:  int											=   {
                 "input_ids": input_ids,
                 "attention_mask": input_mask,
                 "token_type_ids": token_type_ids,
             }

             _UpperCAmelCase					:  Optional[Any]											=   model(A	)
             self.parent.assertEqual(result.start_logits.shape						, (self.batch_size, self.seq_length)	)
             self.parent.assertEqual(result.end_logits.shape						, (self.batch_size, self.seq_length)	)





      def 					_A     (	self						:    Dict	):
             _UpperCAmelCase					:  Optional[Any]											=   self.prepare_config_and_inputs()
             (
                 (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  (
                 _UpperCAmelCase
             )				,  
             )					:  Optional[int]											=   config_and_inputs
             _UpperCAmelCase					:  int											=   {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
             return config, inputs_dict

@require_tf
class      lowerCamelCase_     (snake_case__							,			snake_case__							,			unittest.TestCase   ):
      '''simple docstring'''

      __UpperCamelCase:  str      =						(
          (
              TFDebertaModel,
              TFDebertaForMaskedLM,
              TFDebertaForQuestionAnswering,
              TFDebertaForSequenceClassification,
              TFDebertaForTokenClassification,
          )
          if is_tf_available()
          else ()
      )
      __UpperCamelCase:  Optional[Any]      =						(
          {
              "feature-extraction": TFDebertaModel,
              "fill-mask": TFDebertaForMaskedLM,
              "question-answering": TFDebertaForQuestionAnswering,
              "text-classification": TFDebertaForSequenceClassification,
              "token-classification": TFDebertaForTokenClassification,
              "zero-shot": TFDebertaForSequenceClassification,
          }
          if is_tf_available()
          else {}
      )

      __UpperCamelCase:  List[str]      =						False
      __UpperCamelCase:  Tuple      =						False




      def 					_A     (	self						:    List[str]	):
             _UpperCAmelCase					:  List[str]											=   TFDebertaModelTester(self	)
             _UpperCAmelCase					:  Optional[int]											=   ConfigTester(self						, config_class=A						, hidden_size=37	)




      def 					_A     (	self						:    Optional[Any]	):
             self.config_tester.run_common_tests()




      def 					_A     (	self						:    Dict	):
             _UpperCAmelCase					:  str											=   self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*A	)




      def 					_A     (	self						:    Any	):
             _UpperCAmelCase					:  Optional[Any]											=   self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_masked_lm(*A	)




      def 					_A     (	self						:    Dict	):
             _UpperCAmelCase					:  List[Any]											=   self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_question_answering(*A	)




      def 					_A     (	self						:    Any	):
             _UpperCAmelCase					:  Tuple											=   self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_sequence_classification(*A	)




      def 					_A     (	self						:    Any	):
             _UpperCAmelCase					:  List[str]											=   self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_token_classification(*A	)





      @slow
      def 					_A     (	self						:    Dict	):
             _UpperCAmelCase					:  List[Any]											=   TFDebertaModel.from_pretrained("kamalkraj/deberta-base"	)
             self.assertIsNotNone(A	)

@require_tf
class      lowerCamelCase_     (unittest.TestCase   ):
      '''simple docstring'''

      @unittest.skip(reason="Model not available yet"	)
      def 					_A     (	self						:    Union[str, Any]	):
             pass





      @slow
      def 					_A     (	self						:    int	):
             _UpperCAmelCase					:  Tuple											=   TFDebertaModel.from_pretrained("kamalkraj/deberta-base"	)
             _UpperCAmelCase					:  Union[str, Any]											=   tf.constant([[0, 31414, 232, 328, 740, 1140, 12695, 69, 46078, 1588, 2]]	)
             _UpperCAmelCase					:  Dict											=   tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]	)
             _UpperCAmelCase					:  Any											=   model(A						, attention_mask=A	)[0]

             _UpperCAmelCase					:  Tuple											=   tf.constant(
                 [
                     [
                         [-0.59_855_896, -0.80_552_566, -0.8_462_135],
                         [1.4_484_025, -0.93_483_794, -0.80_593_085],
                         [0.3_122_741, 0.00_316_059, -1.4_131_377],
                     ]
                 ]	)
             tf.debugging.assert_near(output[:, 1:4, 1:4]						, A						, atol=1E-4	)


'''simple docstring'''




def      UpperCamelCase_							( _UpperCAmelCase  :				Optional[int]      ,     _UpperCAmelCase  :				List[Any]   )   ->   List[str]:


       """simple docstring"""







       if len(str(_UpperCAmelCase   )   ) == 1 or len(str(_UpperCAmelCase   )   ) == 1:
              return a * b

       _UpperCAmelCase					:  Any											=   max(len(str(_UpperCAmelCase   )   )      ,     len(str(_UpperCAmelCase   )   )   )
       _UpperCAmelCase					:  Any											=   ma // 2

       _UpperCAmelCase				,  _UpperCAmelCase					:  Union[str, Any]											=   divmod(_UpperCAmelCase      ,     10**ma   )
       _UpperCAmelCase				,  _UpperCAmelCase					:  int											=   divmod(_UpperCAmelCase      ,     10**ma   )

       _UpperCAmelCase					:  List[str]											=   karatsuba(_UpperCAmelCase      ,     _UpperCAmelCase   )
       _UpperCAmelCase					:  int											=   karatsuba((aa + aa)      ,     (ba + ba)   )
       _UpperCAmelCase					:  Any											=   karatsuba(_UpperCAmelCase      ,     _UpperCAmelCase   )

       return (z * 10 ** (2 * ma)) + ((y - z - x) * 10 ** (ma)) + (x)

def      UpperCamelCase_							( )   ->   List[str]:


       """simple docstring"""







       print(karatsuba(15_463      ,     23_489   )   )


if __name__ == "__main__":
  main()

