



'''simple docstring'''
from __future__ import annotations

import unittest

from transformers import MPNetConfig, 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.models.mpnet.modeling_tf_mpnet import (
					    TFMPNetForMaskedLM,
					    TFMPNetForMultipleChoice,
					    TFMPNetForQuestionAnswering,
					    TFMPNetForSequenceClassification,
					    TFMPNetForTokenClassification,
					    TFMPNetModel,
					)






class 							lowercase__			:





	def __init__(				self      :       Tuple				,lowerCamelCase__      :       Union[str, Any]				,lowerCamelCase__      :       List[str]=13				,lowerCamelCase__      :       str=7				,lowerCamelCase__      :       List[Any]=True				,lowerCamelCase__      :       Optional[Any]=True				,lowerCamelCase__      :       Tuple=False				,lowerCamelCase__      :       str=True				,lowerCamelCase__      :       List[Any]=99				,lowerCamelCase__      :       Tuple=64				,lowerCamelCase__      :       List[str]=2				,lowerCamelCase__      :       Any=4				,lowerCamelCase__      :       Union[str, Any]=64				,lowerCamelCase__      :       str="gelu"				,lowerCamelCase__      :       Tuple=0.1				,lowerCamelCase__      :       Optional[int]=0.1				,lowerCamelCase__      :       Dict=512				,lowerCamelCase__      :       Any=16				,lowerCamelCase__      :       List[Any]=2				,lowerCamelCase__      :       List[str]=0.0_2				,lowerCamelCase__      :       int=3				,lowerCamelCase__      :       Any=4				,lowerCamelCase__      :       Any=None				,):







							'''simple docstring'''
							_UpperCamelCase      :	Tuple				       =     parent
							_UpperCamelCase      :	int				       =     batch_size
							_UpperCamelCase      :	Optional[Any]				       =     seq_length
							_UpperCamelCase      :	Optional[Any]				       =     is_training
							_UpperCamelCase      :	Dict				       =     use_input_mask
							_UpperCamelCase      :	Any				       =     use_token_type_ids
							_UpperCamelCase      :	Tuple				       =     use_labels
							_UpperCamelCase      :	Union[str, Any]				       =     vocab_size
							_UpperCamelCase      :	Optional[int]				       =     hidden_size
							_UpperCamelCase      :	List[Any]				       =     num_hidden_layers
							_UpperCamelCase      :	int				       =     num_attention_heads
							_UpperCamelCase      :	Optional[int]				       =     intermediate_size
							_UpperCamelCase      :	Tuple				       =     hidden_act
							_UpperCamelCase      :	Dict				       =     hidden_dropout_prob
							_UpperCamelCase      :	Dict				       =     attention_probs_dropout_prob
							_UpperCamelCase      :	Union[str, Any]				       =     max_position_embeddings
							_UpperCamelCase      :	Dict				       =     type_vocab_size
							_UpperCamelCase      :	List[Any]				       =     type_sequence_label_size
							_UpperCamelCase      :	Any				       =     initializer_range
							_UpperCamelCase      :	Dict				       =     num_labels
							_UpperCamelCase      :	str				       =     num_choices
							_UpperCamelCase      :	Any				       =     scope





	def 			UpperCamelCase_						(				self      :       str				):







							'''simple docstring'''
							_UpperCamelCase      :	Dict				       =     ids_tensor([self.batch_size, self.seq_length]				,self.vocab_size				)

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

							_UpperCamelCase      :	Dict				       =     None
							_UpperCamelCase      :	List[Any]				       =     None
							_UpperCamelCase      :	Tuple				       =     None
							if self.use_labels:
													_UpperCamelCase      :	Optional[int]				       =     ids_tensor([self.batch_size]				,self.type_sequence_label_size				)
													_UpperCamelCase      :	Tuple				       =     ids_tensor([self.batch_size, self.seq_length]				,self.num_labels				)
													_UpperCamelCase      :	Optional[int]				       =     ids_tensor([self.batch_size]				,self.num_choices				)

							_UpperCamelCase      :	int				       =     MPNetConfig(
							    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				,initializer_range=self.initializer_range				,)
							return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels





	def 			UpperCamelCase_						(				self      :       Tuple				,lowerCamelCase__      :       Union[str, Any]				,lowerCamelCase__      :       List[str]				,lowerCamelCase__      :       Optional[Any]				,lowerCamelCase__      :       List[Any]				,lowerCamelCase__      :       Tuple				,lowerCamelCase__      :       Union[str, Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	Any				       =     TFMPNetModel(config=lowerCamelCase__				)
							_UpperCamelCase      :	int				       =     {'input_ids': input_ids, 'attention_mask': input_mask}
							_UpperCamelCase      :	List[str]				       =     model(lowerCamelCase__				)
							_UpperCamelCase      :	Union[str, Any]				       =     [input_ids, input_mask]
							_UpperCamelCase      :	List[str]				       =     model(lowerCamelCase__				)
							self.parent.assertEqual(result.last_hidden_state.shape				,(self.batch_size, self.seq_length, self.hidden_size)				)





	def 			UpperCamelCase_						(				self      :       Dict				,lowerCamelCase__      :       int				,lowerCamelCase__      :       Optional[Any]				,lowerCamelCase__      :       List[str]				,lowerCamelCase__      :       List[Any]				,lowerCamelCase__      :       Union[str, Any]				,lowerCamelCase__      :       str				):







							'''simple docstring'''
							_UpperCamelCase      :	Any				       =     TFMPNetForMaskedLM(config=lowerCamelCase__				)
							_UpperCamelCase      :	List[Any]				       =     {'input_ids': input_ids, 'attention_mask': input_mask}
							_UpperCamelCase      :	int				       =     model(lowerCamelCase__				)
							self.parent.assertEqual(result.logits.shape				,(self.batch_size, self.seq_length, self.vocab_size)				)





	def 			UpperCamelCase_						(				self      :       Tuple				,lowerCamelCase__      :       str				,lowerCamelCase__      :       str				,lowerCamelCase__      :       int				,lowerCamelCase__      :       Any				,lowerCamelCase__      :       Optional[int]				,lowerCamelCase__      :       Tuple				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     TFMPNetForQuestionAnswering(config=lowerCamelCase__				)
							_UpperCamelCase      :	List[str]				       =     {
							    'input_ids': input_ids,
							    'attention_mask': input_mask,
							}
							_UpperCamelCase      :	str				       =     model(lowerCamelCase__				)
							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 			UpperCamelCase_						(				self      :       Dict				,lowerCamelCase__      :       Optional[Any]				,lowerCamelCase__      :       Dict				,lowerCamelCase__      :       str				,lowerCamelCase__      :       str				,lowerCamelCase__      :       str				,lowerCamelCase__      :       Union[str, Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.num_labels
							_UpperCamelCase      :	Any				       =     TFMPNetForSequenceClassification(lowerCamelCase__				)
							_UpperCamelCase      :	Optional[int]				       =     {'input_ids': input_ids, 'attention_mask': input_mask}
							_UpperCamelCase      :	Union[str, Any]				       =     model(lowerCamelCase__				)
							self.parent.assertEqual(result.logits.shape				,(self.batch_size, self.num_labels)				)





	def 			UpperCamelCase_						(				self      :       Tuple				,lowerCamelCase__      :       Optional[int]				,lowerCamelCase__      :       int				,lowerCamelCase__      :       Tuple				,lowerCamelCase__      :       Tuple				,lowerCamelCase__      :       int				,lowerCamelCase__      :       List[Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	str				       =     self.num_choices
							_UpperCamelCase      :	Optional[int]				       =     TFMPNetForMultipleChoice(lowerCamelCase__				)
							_UpperCamelCase      :	List[Any]				       =     tf.tile(tf.expand_dims(lowerCamelCase__				,1				)				,(1, self.num_choices, 1)				)
							_UpperCamelCase      :	Optional[int]				       =     tf.tile(tf.expand_dims(lowerCamelCase__				,1				)				,(1, self.num_choices, 1)				)
							_UpperCamelCase      :	Any				       =     {
							    'input_ids': multiple_choice_inputs_ids,
							    'attention_mask': multiple_choice_input_mask,
							}
							_UpperCamelCase      :	Optional[Any]				       =     model(lowerCamelCase__				)
							self.parent.assertEqual(result.logits.shape				,(self.batch_size, self.num_choices)				)





	def 			UpperCamelCase_						(				self      :       Tuple				,lowerCamelCase__      :       Dict				,lowerCamelCase__      :       List[str]				,lowerCamelCase__      :       str				,lowerCamelCase__      :       Dict				,lowerCamelCase__      :       Optional[int]				,lowerCamelCase__      :       Optional[Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	str				       =     self.num_labels
							_UpperCamelCase      :	Dict				       =     TFMPNetForTokenClassification(lowerCamelCase__				)
							_UpperCamelCase      :	str				       =     {'input_ids': input_ids, 'attention_mask': input_mask}
							_UpperCamelCase      :	Dict				       =     model(lowerCamelCase__				)
							self.parent.assertEqual(result.logits.shape				,(self.batch_size, self.seq_length, self.num_labels)				)





	def 			UpperCamelCase_						(				self      :       str				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.prepare_config_and_inputs()
							((_UpperCamelCase)       ,    (_UpperCamelCase)       ,    (_UpperCamelCase)       ,    (_UpperCamelCase)       ,    (_UpperCamelCase)       ,    (_UpperCamelCase))      :	Optional[Any]				       =     config_and_inputs
							_UpperCamelCase      :	str				       =     {'input_ids': input_ids, 'attention_mask': input_mask}
							return config, inputs_dict






@require_tf
class 							lowercase__			(							lowercase		,      lowercase		,      unittest.TestCase     ):
	lowercase__						       =    (
	    (
	        TFMPNetForMaskedLM,
	        TFMPNetForMultipleChoice,
	        TFMPNetForQuestionAnswering,
	        TFMPNetForSequenceClassification,
	        TFMPNetForTokenClassification,
	        TFMPNetModel,
	    )
	    if is_tf_available()
	    else ()
	)
	lowercase__						       =    (
	    {
	        """feature-extraction""": TFMPNetModel,
	        """fill-mask""": TFMPNetForMaskedLM,
	        """question-answering""": TFMPNetForQuestionAnswering,
	        """text-classification""": TFMPNetForSequenceClassification,
	        """token-classification""": TFMPNetForTokenClassification,
	        """zero-shot""": TFMPNetForSequenceClassification,
	    }
	    if is_tf_available()
	    else {}
	)
	lowercase__						       =    False
	lowercase__						       =    False





	def 			UpperCamelCase_						(				self      :       int				):







							'''simple docstring'''
							_UpperCamelCase      :	Dict				       =     TFMPNetModelTester(self				)
							_UpperCamelCase      :	List[str]				       =     ConfigTester(self				,config_class=lowerCamelCase__				,hidden_size=37				)





	def 			UpperCamelCase_						(				self      :       List[str]				):







							'''simple docstring'''
							self.config_tester.run_common_tests()





	def 			UpperCamelCase_						(				self      :       Tuple				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_model(*lowerCamelCase__				)





	def 			UpperCamelCase_						(				self      :       Optional[int]				):







							'''simple docstring'''
							_UpperCamelCase      :	Any				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_for_masked_lm(*lowerCamelCase__				)





	def 			UpperCamelCase_						(				self      :       Optional[int]				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_for_question_answering(*lowerCamelCase__				)





	def 			UpperCamelCase_						(				self      :       int				):







							'''simple docstring'''
							_UpperCamelCase      :	List[str]				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_for_sequence_classification(*lowerCamelCase__				)





	def 			UpperCamelCase_						(				self      :       Union[str, Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_for_multiple_choice(*lowerCamelCase__				)





	def 			UpperCamelCase_						(				self      :       Optional[Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	Optional[Any]				       =     self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_mpnet_for_token_classification(*lowerCamelCase__				)





	@slow
	def 			UpperCamelCase_						(				self      :       List[str]				):







							'''simple docstring'''
							for model_name in ["microsoft/mpnet-base"]:
													_UpperCamelCase      :	List[Any]				       =     TFMPNetModel.from_pretrained(lowerCamelCase__				)
													self.assertIsNotNone(lowerCamelCase__				)






@require_tf
class 							lowercase__			(							unittest.TestCase     ):





	@slow
	def 			UpperCamelCase_						(				self      :       Optional[Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	Union[str, Any]				       =     TFMPNetModel.from_pretrained('microsoft/mpnet-base'				)
							_UpperCamelCase      :	Union[str, Any]				       =     tf.constant([[0, 1, 2, 3, 4, 5]]				)
							_UpperCamelCase      :	str				       =     model(lowerCamelCase__				)[0]

							_UpperCamelCase      :	Tuple				       =     [1, 6, 768]
							self.assertEqual(output.shape				,lowerCamelCase__				)

							_UpperCamelCase      :	Any				       =     tf.constant(
							    [
							        [
							            [-0.1_0_6_7_1_7_2, 0.0_8_2_1_6_4_7_3, 0.0_0_2_4_5_4_3],
							            [-0.0_3_4_6_5_8_7_9, 0.8_3_5_4_1_1_8, -0.0_3_2_5_2_2_8_8],
							            [-0.0_6_5_6_9_4_7_6, -0.1_2_4_2_4_1_1_1, -0.0_4_9_4_4_3_6],
							        ]
							    ]				)
							tf.debugging.assert_near(output[:, :3, :3]				,lowerCamelCase__				,atol=1E-4				)







'''simple docstring'''
import math






def A__					(  UpperCAmelCase_							):

						if 1 < number < 4:
												# 2 and 3 are primes
												return True
						elif number < 2 or number % 2 == 0 or number % 3 == 0:
												# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
												return False

						# All primes number are in format of 6k +/- 1
						for i in range(5						,						int(math.sqrt(UpperCAmelCase_							) + 1							)						,						6							):
												if number % i == 0 or number % (i + 2) == 0:
																		return False
						return True






def A__					(  UpperCAmelCase_ = 1_0_0_0						,						UpperCAmelCase_ = 1_0_0_0							):
						_UpperCamelCase      :	str				       =     [0, 0, 0]  # length, a, b
						for a in range((a_limit * -1) + 1						,						UpperCAmelCase_							):
												for b in range(2						,						UpperCAmelCase_							):
																		if is_prime(UpperCAmelCase_							):
																								_UpperCamelCase      :	List[str]				       =     0
																								_UpperCamelCase      :	Union[str, Any]				       =     0
																								while is_prime((n**2) + (a * n) + b							):
																														count += 1
																														n += 1
																								if count > longest[0]:
																														_UpperCamelCase      :	Any				       =     [count, a, b]
						_UpperCamelCase      :	Dict				       =     longest[1] * longest[2]
						return ans


if __name__ == "__main__":
					print(solution(1000, 1000))


