


import unittest

import numpy as np

from transformers import RobertaConfig, 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.roberta.modeling_flax_roberta import (
		    FlaxRobertaForCausalLM,
		    FlaxRobertaForMaskedLM,
		    FlaxRobertaForMultipleChoice,
		    FlaxRobertaForQuestionAnswering,
		    FlaxRobertaForSequenceClassification,
		    FlaxRobertaForTokenClassification,
		    FlaxRobertaModel,
		)







class        __lowercase       (							unittest.TestCase  ):



		"""simple docstring"""

		def __init__( self		,      A		,      A=13		,      A=7		,      A=True		,      A=True		,      A=True		,      A=True		,      A=99		,      A=32		,      A=5		,      A=4		,      A=37		,      A="gelu"		,      A=0.1		,      A=0.1		,      A=5_12		,      A=16		,      A=2		,      A=0.02		,      A=4		,      )  -> Optional[Any]:







					'''simple docstring'''







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







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







					'''simple docstring'''







					lowerCamelCase    		=  ids_tensor([self.batch_size, self.seq_length]		,      self.vocab_size	)

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

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

					lowerCamelCase    		=  RobertaConfig(
					    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=A		,      initializer_range=self.initializer_range		,      )

					return config, input_ids, token_type_ids, attention_mask







		def 					__A   ( self	)  -> str:







					'''simple docstring'''







					lowerCamelCase    		=  self.prepare_config_and_inputs()
					lowerCamelCase		,		lowerCamelCase		,		lowerCamelCase		,		lowerCamelCase    		=  config_and_inputs
					lowerCamelCase    		=  {"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": attention_mask}
					return config, inputs_dict







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







					'''simple docstring'''







					lowerCamelCase    		=  self.prepare_config_and_inputs()
					lowerCamelCase		,		lowerCamelCase		,		lowerCamelCase		,		lowerCamelCase    		=  config_and_inputs

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

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







@require_flax
class        __lowercase       (							a_			,							unittest.TestCase  ):



		"""simple docstring"""

		UpperCamelCase     :					Any			       =		True

		UpperCamelCase     :					Dict			       =		(
		    (
		        FlaxRobertaModel,
		        FlaxRobertaForCausalLM,
		        FlaxRobertaForMaskedLM,
		        FlaxRobertaForSequenceClassification,
		        FlaxRobertaForTokenClassification,
		        FlaxRobertaForMultipleChoice,
		        FlaxRobertaForQuestionAnswering,
		    )
		    if is_flax_available()
		    else ()
		)







		def 					__A   ( self	)  -> int:







					'''simple docstring'''







					lowerCamelCase    		=  FlaxRobertaModelTester(self	)







		@slow
		def 					__A   ( self	)  -> int:







					'''simple docstring'''







					for model_class_name in self.all_model_classes:
								lowerCamelCase    		=  model_class_name.from_pretrained("""roberta-base"""		,      from_pt=A	)
								lowerCamelCase    		=  model(np.ones((1, 1)	)	)
								self.assertIsNotNone(A	)





def 	__lowerCamelCase						(							lowerCamelCase__		:						int      ):





			'''simple docstring'''




			lowerCamelCase    		=  (1 + 24 * n) ** 0.5
			return ((1 + root) / 6) % 1 == 0






def 	__lowerCamelCase						(							lowerCamelCase__		:						int = 5000      ):





			'''simple docstring'''




			lowerCamelCase    		=  [(i * (3 * i - 1)) // 2 for i in range(1  ,							lowerCamelCase__      )]
			for i, pentagonal_i in enumerate(lowerCamelCase__      ):
						for j in range(lowerCamelCase__  ,							len(lowerCamelCase__      )      ):
									lowerCamelCase    		=  pentagonal_nums[j]
									lowerCamelCase    		=  pentagonal_i + pentagonal_j
									lowerCamelCase    		=  pentagonal_j - pentagonal_i
									if is_pentagonal(lowerCamelCase__      ) and is_pentagonal(lowerCamelCase__      ):
												return b

			return -1


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

