"""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    __snake_case       (     unittest.TestCase				):



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





        '''simple docstring'''





        a__:     int										=	parent
        a__:     Optional[int]										=	batch_size
        a__:     str										=	seq_length
        a__:     Union[str, Any]										=	is_training
        a__:     Tuple										=	use_attention_mask
        a__:     Any										=	use_token_type_ids
        a__:     Tuple										=	use_labels
        a__:     int										=	vocab_size
        a__:     Any										=	hidden_size
        a__:     Tuple										=	num_hidden_layers
        a__:     Union[str, Any]										=	num_attention_heads
        a__:     Union[str, Any]										=	intermediate_size
        a__:     Tuple										=	hidden_act
        a__:     List[str]										=	hidden_dropout_prob
        a__:     Union[str, Any]										=	attention_probs_dropout_prob
        a__:     Union[str, Any]										=	max_position_embeddings
        a__:     Optional[int]										=	type_vocab_size
        a__:     Tuple										=	type_sequence_label_size
        a__:     Optional[Any]										=	initializer_range
        a__:     Any										=	num_choices



      def   lowerCamelCase_   (						self)	->			Optional[int]:





        '''simple docstring'''





        a__:     Tuple										=	ids_tensor([self.batch_size, self.seq_length]    ,			self.vocab_size)

        a__:     List[Any]										=	None
        if self.use_attention_mask:
          a__:     Union[str, Any]										=	random_attention_mask([self.batch_size, self.seq_length])

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

        a__:     Tuple										=	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=lowercase    ,			initializer_range=self.initializer_range    ,			)

        return config, input_ids, token_type_ids, attention_mask



      def   lowerCamelCase_   (						self)	->			str:





        '''simple docstring'''





        a__:     Optional[int]										=	self.prepare_config_and_inputs()
        a__							,    a__							,    a__							,    a__:     Optional[int]										=	config_and_inputs
        a__:     List[str]										=	{'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': attention_mask}
        return config, inputs_dict



      def   lowerCamelCase_   (						self)	->			Any:





        '''simple docstring'''





        a__:     Optional[Any]										=	self.prepare_config_and_inputs()
        a__							,    a__							,    a__							,    a__:     List[str]										=	config_and_inputs

        a__:     Dict										=	True
        a__:     Optional[Any]										=	floats_tensor([self.batch_size, self.seq_length, self.hidden_size])
        a__:     Any										=	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    __snake_case       (     __lowerCAmelCase       ,      unittest.TestCase				):
      a__        =		True

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



      def   lowerCamelCase_   (						self)	->			int:





        '''simple docstring'''





        a__:     Tuple										=	FlaxBertModelTester(self)



      @slow
      def   lowerCamelCase_   (						self)	->			Union[str, Any]:





        '''simple docstring'''





        a__:     Any										=	FlaxBertModel.from_pretrained('bert-base-cased')
        a__:     str										=	model(np.ones((1, 1)))
        self.assertIsNotNone(lowercase)



"""simple docstring"""
import math







def 						__a   (	_SCREAMING_SNAKE_CASE   )	->bool:

  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(_SCREAMING_SNAKE_CASE   ) + 1   )		,     6   ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True







def 						__a   (	_SCREAMING_SNAKE_CASE = 0.1   )	->int:
  a__:     str										=	3
  a__:     Optional[Any]										=	3

  while primes / (2 * j - 1) >= ratio:
    for i in range(j * j + j + 1		,     (j + 2) * (j + 2)		,     j + 1   ):
      primes += is_prime(_SCREAMING_SNAKE_CASE   )
    j += 2
  return j


if __name__ == "__main__":
 import doctest

 doctest.testmod()


