
'''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__     :






					def __init__(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE=13       ,							__SCREAMING_SNAKE_CASE=7       ,							__SCREAMING_SNAKE_CASE=True       ,							__SCREAMING_SNAKE_CASE=True       ,							__SCREAMING_SNAKE_CASE=True       ,							__SCREAMING_SNAKE_CASE=True       ,							__SCREAMING_SNAKE_CASE=99       ,							__SCREAMING_SNAKE_CASE=32       ,							__SCREAMING_SNAKE_CASE=2       ,							__SCREAMING_SNAKE_CASE=4       ,							__SCREAMING_SNAKE_CASE=37       ,							__SCREAMING_SNAKE_CASE="gelu"       ,							__SCREAMING_SNAKE_CASE=0.1       ,							__SCREAMING_SNAKE_CASE=0.1       ,							__SCREAMING_SNAKE_CASE=5_12       ,							__SCREAMING_SNAKE_CASE=16       ,							__SCREAMING_SNAKE_CASE=2       ,							__SCREAMING_SNAKE_CASE=0.02       ,							__SCREAMING_SNAKE_CASE=3       ,							__SCREAMING_SNAKE_CASE=4       ,							__SCREAMING_SNAKE_CASE=None       ,							):


											"""simple docstring"""





											lowercase_			:  Any									= parent
											lowercase_			:  Optional[Any]									= 13
											lowercase_			:  Dict									= 7
											lowercase_			:  Any									= True
											lowercase_			:  Optional[Any]									= True
											lowercase_			:  str									= True
											lowercase_			:  Dict									= True
											lowercase_			:  Dict									= 99
											lowercase_			:  Optional[Any]									= 32
											lowercase_			:  Optional[int]									= 2
											lowercase_			:  Optional[int]									= 4
											lowercase_			:  str									= 37
											lowercase_			:  Dict									= '''gelu'''
											lowercase_			:  Tuple									= 0.1
											lowercase_			:  Optional[int]									= 0.1
											lowercase_			:  Optional[Any]									= 5_12
											lowercase_			:  List[str]									= 16
											lowercase_			:  str									= False
											lowercase_			:  str									= -1
											lowercase_			:  Union[str, Any]									= True
											lowercase_			:  int									= 2
											lowercase_			:  Tuple									= 0.02
											lowercase_			:  Optional[Any]									= 3
											lowercase_			:  Any									= 4
											lowercase_			:  Optional[Any]									= None






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Optional[int]									= ids_tensor([self.batch_size, self.seq_length]       ,							self.vocab_size	)

											lowercase_			:  Dict									= None
											if self.use_input_mask:
																	lowercase_			:  Union[str, Any]									= random_attention_mask([self.batch_size, self.seq_length]	)

											lowercase_			:  str									= None
											if self.use_token_type_ids:
																	lowercase_			:  int									= ids_tensor([self.batch_size, self.seq_length]       ,							self.type_vocab_size	)

											lowercase_			:  Optional[int]									= None
											lowercase_			:  int									= None
											lowercase_			:  List[str]									= None
											if self.use_labels:
																	lowercase_			:  Any									= ids_tensor([self.batch_size]       ,							self.type_sequence_label_size	)
																	lowercase_			:  str									= ids_tensor([self.batch_size, self.seq_length]       ,							self.num_labels	)

											lowercase_			:  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=UpperCamelCase__       ,							)

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






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  Tuple									= TFDebertaModel(config=UpperCamelCase__	)
											lowercase_			:  Optional[Any]									= {'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}

											lowercase_			:  Dict									= [input_ids, input_mask]
											lowercase_			:  Optional[Any]									= model(UpperCamelCase__	)

											lowercase_			:  List[str]									= model(UpperCamelCase__	)

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






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  Dict									= TFDebertaForMaskedLM(config=UpperCamelCase__	)
											lowercase_			:  str									= {
											    '''input_ids''': input_ids,
											    '''attention_mask''': input_mask,
											    '''token_type_ids''': token_type_ids,
											}
											lowercase_			:  Any									= model(UpperCamelCase__	)
											self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.seq_length, self.vocab_size)	)






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  Optional[int]									= self.num_labels
											lowercase_			:  Optional[int]									= TFDebertaForSequenceClassification(config=UpperCamelCase__	)
											lowercase_			:  str									= {
											    '''input_ids''': input_ids,
											    '''attention_mask''': input_mask,
											    '''token_type_ids''': token_type_ids,
											}

											lowercase_			:  List[Any]									= model(UpperCamelCase__	)
											self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.num_labels)	)






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  Dict									= self.num_labels
											lowercase_			:  int									= TFDebertaForTokenClassification(config=UpperCamelCase__	)
											lowercase_			:  List[Any]									= {
											    '''input_ids''': input_ids,
											    '''attention_mask''': input_mask,
											    '''token_type_ids''': token_type_ids,
											}
											lowercase_			:  int									= model(UpperCamelCase__	)
											self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.seq_length, self.num_labels)	)






					def 			_snake_case					(     self       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE       ,							__SCREAMING_SNAKE_CASE	):


											"""simple docstring"""





											lowercase_			:  List[Any]									= TFDebertaForQuestionAnswering(config=UpperCamelCase__	)
											lowercase_			:  Optional[Any]									= {
											    '''input_ids''': input_ids,
											    '''attention_mask''': input_mask,
											    '''token_type_ids''': token_type_ids,
											}

											lowercase_			:  List[Any]									= model(UpperCamelCase__	)
											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 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Optional[Any]									= self.prepare_config_and_inputs()
											(
											    lowercase_
											)			:  Optional[int]									= config_and_inputs
											lowercase_			:  int									= {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
											return config, inputs_dict







@require_tf
class 				lowerCAmelCase__     (						__SCREAMING_SNAKE_CASE					,		__SCREAMING_SNAKE_CASE					,		unittest.TestCase  ):
					lowerCAmelCase_       =  (
					    (
					        TFDebertaModel,
					        TFDebertaForMaskedLM,
					        TFDebertaForQuestionAnswering,
					        TFDebertaForSequenceClassification,
					        TFDebertaForTokenClassification,
					    )
					    if is_tf_available()
					    else ()
					)
					lowerCAmelCase_       =  (
					    {
					        '''feature-extraction''': TFDebertaModel,
					        '''fill-mask''': TFDebertaForMaskedLM,
					        '''question-answering''': TFDebertaForQuestionAnswering,
					        '''text-classification''': TFDebertaForSequenceClassification,
					        '''token-classification''': TFDebertaForTokenClassification,
					        '''zero-shot''': TFDebertaForSequenceClassification,
					    }
					    if is_tf_available()
					    else {}
					)

					lowerCAmelCase_       =  False
					lowerCAmelCase_       =  False






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Tuple									= TFDebertaModelTester(self	)
											lowercase_			:  Tuple									= ConfigTester(self       ,							config_class=UpperCamelCase__       ,							hidden_size=37	)






					def 			_snake_case					(     self	):


											"""simple docstring"""





											self.config_tester.run_common_tests()






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  str									= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*UpperCamelCase__	)






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Optional[int]									= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_lm(*UpperCamelCase__	)






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  List[str]									= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*UpperCamelCase__	)






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  List[Any]									= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*UpperCamelCase__	)






					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Dict									= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*UpperCamelCase__	)






					@slow
					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  List[str]									= TFDebertaModel.from_pretrained('''kamalkraj/deberta-base'''	)
											self.assertIsNotNone(UpperCamelCase__	)







@require_tf
class 				lowerCAmelCase__     (						unittest.TestCase  ):






					@unittest.skip(reason='''Model not available yet'''	)
					def 			_snake_case					(     self	):


											"""simple docstring"""





											pass






					@slow
					def 			_snake_case					(     self	):


											"""simple docstring"""





											lowercase_			:  Union[str, Any]									= TFDebertaModel.from_pretrained('''kamalkraj/deberta-base'''	)
											lowercase_			:  List[Any]									= tf.constant([[0, 3_14_14, 2_32, 3_28, 7_40, 11_40, 1_26_95, 69, 4_60_78, 15_88, 2]]	)
											lowercase_			:  str									= tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]	)
											lowercase_			:  Tuple									= model(UpperCamelCase__       ,							attention_mask=UpperCamelCase__	)[0]

											lowercase_			:  Optional[int]									= 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]       ,							UpperCamelCase__       ,							atol=1E-4	)






'''simple docstring'''







def       snake_case_	(       __SCREAMING_SNAKE_CASE      :				int = 998001							):



						"""simple docstring"""





						lowercase_			:  Dict									= 0
						for i in range(999   ,   99   ,   -1							):  # 3 digit numbers range from 999 down to 100
												for j in range(999   ,   99   ,   -1							):
																		lowercase_			:  int									= str(i * j							)
																		if product_string == product_string[::-1] and i * j < n:
																								lowercase_			:  str									= max(__SCREAMING_SNAKE_CASE   ,   i * j							)
						return answer


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



