

'''simple docstring'''







import unittest

import numpy as np

from transformers import BertConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
						from transformers.models.bert.modeling_flax_bert import (
						    FlaxBertForMaskedLM,
						    FlaxBertForMultipleChoice,
						    FlaxBertForNextSentencePrediction,
						    FlaxBertForPreTraining,
						    FlaxBertForQuestionAnswering,
						    FlaxBertForSequenceClassification,
						    FlaxBertForTokenClassification,
						    FlaxBertModel,
						)


class 					A__      (      unittest.TestCase			):



				def __init__(					self		,				UpperCamelCase__		,				UpperCamelCase__=13		,				UpperCamelCase__=7		,				UpperCamelCase__=True		,				UpperCamelCase__=True		,				UpperCamelCase__=True		,				UpperCamelCase__=True		,				UpperCamelCase__=99		,				UpperCamelCase__=32		,				UpperCamelCase__=5		,				UpperCamelCase__=4		,				UpperCamelCase__=37		,				UpperCamelCase__="gelu"		,				UpperCamelCase__=0.1		,				UpperCamelCase__=0.1		,				UpperCamelCase__=512		,				UpperCamelCase__=16		,				UpperCamelCase__=2		,				UpperCamelCase__=0.02		,				UpperCamelCase__=4		,				)						->      Any:





											'''simple docstring'''
											A_						=      parent
											A_						=      batch_size
											A_						=      seq_length
											A_						=      is_training
											A_						=      use_attention_mask
											A_						=      use_token_type_ids
											A_						=      use_labels
											A_						=      vocab_size
											A_						=      hidden_size
											A_						=      num_hidden_layers
											A_						=      num_attention_heads
											A_						=      intermediate_size
											A_						=      hidden_act
											A_						=      hidden_dropout_prob
											A_						=      attention_probs_dropout_prob
											A_						=      max_position_embeddings
											A_						=      type_vocab_size
											A_						=      type_sequence_label_size
											A_						=      initializer_range
											A_						=      num_choices



				def 					snake_case_			(					self       )						->      List[str]:





											'''simple docstring'''
											A_						=      ids_tensor([self.batch_size, self.seq_length]		,				self.vocab_size       )

											A_						=      None
											if self.use_attention_mask:
																		A_						=      random_attention_mask([self.batch_size, self.seq_length]       )

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

											A_						=      BertConfig(
											    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		,				is_decoder=UpperCamelCase__		,				initializer_range=self.initializer_range		,				)

											return config, input_ids, token_type_ids, attention_mask



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





											'''simple docstring'''
											A_						=      self.prepare_config_and_inputs()
											A_						=      config_and_inputs
											A_						=      {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': attention_mask}
											return config, inputs_dict







				def 					snake_case_			(					self       )						->      int:





											'''simple docstring'''
											A_						=      self.prepare_config_and_inputs()
											A_						=      config_and_inputs

											A_						=      True
											A_						=      floats_tensor([self.batch_size, self.seq_length, self.hidden_size]       )
											A_						=      ids_tensor([self.batch_size, self.seq_length]		,				vocab_size=2       )

											return (
											    config,
											    input_ids,
											    attention_mask,
											    encoder_hidden_states,
											    encoder_attention_mask,
											)


@require_flax
class 					A__      (      __A						,						unittest.TestCase			):
				lowercase						=		True

				lowercase						=		(
				    (
				        FlaxBertModel,
				        FlaxBertForPreTraining,
				        FlaxBertForMaskedLM,
				        FlaxBertForMultipleChoice,
				        FlaxBertForQuestionAnswering,
				        FlaxBertForNextSentencePrediction,
				        FlaxBertForSequenceClassification,
				        FlaxBertForTokenClassification,
				        FlaxBertForQuestionAnswering,
				    )
				    if is_flax_available()
				    else ()
				)



				def 					snake_case_			(					self       )						->      int:





											'''simple docstring'''
											A_						=      FlaxBertModelTester(self       )







				@slow
				def 					snake_case_			(					self       )						->      Optional[int]:





											'''simple docstring'''
											# Only check this for base model, not necessary for all model classes.
											# This will also help speed-up tests.
											A_						=      FlaxBertModel.from_pretrained("""bert-base-cased"""       )
											A_						=      model(np.ones((1, 1)       )       )
											self.assertIsNotNone(UpperCamelCase__       )



'''simple docstring'''







def       UpperCAmelCase__    (      UpperCAmelCase__				)			->			bool:
       return str(UpperCAmelCase__				) == str(UpperCAmelCase__				)[::-1]
def       UpperCAmelCase__    (      UpperCAmelCase__				)			->			int:
       return int(UpperCAmelCase__				) + int(str(UpperCAmelCase__				)[::-1]				)
def       UpperCAmelCase__    (      UpperCAmelCase__ = 1_00_00				)			->			int:
       A_						=      []
       for num in range(1,       UpperCAmelCase__				):
              A_						=      0
              A_						=      num
              while iterations < 50:
                     A_						=      sum_reverse(UpperCAmelCase__				)
                     iterations += 1
                     if is_palindrome(UpperCAmelCase__				):
                            break
              else:
                     lychrel_nums.append(UpperCAmelCase__				)
       return len(UpperCAmelCase__				)


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