'''simple docstring'''





import unittest

import numpy as np

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

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
    import jax.numpy as jnp

    from transformers.models.roformer.modeling_flax_roformer import (
        FlaxRoFormerForMaskedLM,
        FlaxRoFormerForMultipleChoice,
        FlaxRoFormerForQuestionAnswering,
        FlaxRoFormerForSequenceClassification,
        FlaxRoFormerForTokenClassification,
        FlaxRoFormerModel,
    )




class        __A      ( unittest.TestCase	):



    def __init__(self    :    List[str]   ,			__a    :    Union[str, Any]   ,			__a    :    List[str]=13   ,			__a    :    List[Any]=7   ,			__a    :    Union[str, Any]=True   ,			__a    :    Any=True   ,			__a    :    List[Any]=True   ,			__a    :    str=True   ,			__a    :    List[Any]=99   ,			__a    :    Any=32   ,			__a    :    Tuple=5   ,			__a    :    Union[str, Any]=4   ,			__a    :    List[str]=37   ,			__a    :    Tuple="gelu"   ,			__a    :    int=0.1   ,			__a    :    str=0.1   ,			__a    :    List[Any]=512   ,			__a    :    Optional[int]=16   ,			__a    :    Tuple=2   ,			__a    :    Any=0.02   ,			__a    :    Union[str, Any]=4   ,			):
         UpperCAmelCase_           =   parent
         UpperCAmelCase_           =   batch_size
         UpperCAmelCase_           =   seq_length
         UpperCAmelCase_           =   is_training
         UpperCAmelCase_           =   use_attention_mask
         UpperCAmelCase_           =   use_token_type_ids
         UpperCAmelCase_           =   use_labels
         UpperCAmelCase_           =   vocab_size
         UpperCAmelCase_           =   hidden_size
         UpperCAmelCase_           =   num_hidden_layers
         UpperCAmelCase_           =   num_attention_heads
         UpperCAmelCase_           =   intermediate_size
         UpperCAmelCase_           =   hidden_act
         UpperCAmelCase_           =   hidden_dropout_prob
         UpperCAmelCase_           =   attention_probs_dropout_prob
         UpperCAmelCase_           =   max_position_embeddings
         UpperCAmelCase_           =   type_vocab_size
         UpperCAmelCase_           =   type_sequence_label_size
         UpperCAmelCase_           =   initializer_range
         UpperCAmelCase_           =   num_choices



    def 					_lowercase						(self    :    int ):
         UpperCAmelCase_           =   ids_tensor([self.batch_size, self.seq_length]   ,			self.vocab_size )

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

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

         UpperCAmelCase_           =   RoFormerConfig(
             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 					_lowercase						(self    :    List[Any] ):
         UpperCAmelCase_           =   self.prepare_config_and_inputs()
         UpperCAmelCase_    , UpperCAmelCase_    , UpperCAmelCase_    , UpperCAmelCase_           =   config_and_inputs
         UpperCAmelCase_           =   {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask}
         return config, inputs_dict




@require_flax
class        __A      ( UpperCamelCase__		,	unittest.TestCase	):
    a__       :						Dict          =  True

    a__       :						Dict          =  (
        (
            FlaxRoFormerModel,
            FlaxRoFormerForMaskedLM,
            FlaxRoFormerForSequenceClassification,
            FlaxRoFormerForTokenClassification,
            FlaxRoFormerForMultipleChoice,
            FlaxRoFormerForQuestionAnswering,
        )
        if is_flax_available()
        else ()
    )



    def 					_lowercase						(self    :    Dict ):
         UpperCAmelCase_           =   FlaxRoFormerModelTester(self )






    @slow
    def 					_lowercase						(self    :    Optional[Any] ):
         for model_class_name in self.all_model_classes:
              UpperCAmelCase_           =   model_class_name.from_pretrained("junnyu/roformer_chinese_small"   ,			from_pt=__a )
              UpperCAmelCase_           =   model(np.ones((1, 1) ) )
              self.assertIsNotNone(__a )




@require_flax
class        __A      ( unittest.TestCase	):



    @slow
    def 					_lowercase						(self    :    List[Any] ):
         UpperCAmelCase_           =   FlaxRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base" )
         UpperCAmelCase_           =   jnp.array([[0, 1, 2, 3, 4, 5]] )
         UpperCAmelCase_           =   model(__a )[0]

         UpperCAmelCase_           =   50000

         UpperCAmelCase_           =   (1, 6, vocab_size)
         self.assertEqual(output.shape   ,			__a )

         UpperCAmelCase_           =   jnp.array(
             [[[-0.12_05, -1.02_65, 0.29_22], [-1.51_34, 0.19_74, 0.15_19], [-5.01_35, -3.90_03, -0.84_04]]] )

         self.assertTrue(jnp.allclose(output[:, :3, :3]   ,			__a   ,			atol=1E-4 ) )










def 						lowerCamelCase__    (		):







	'''simple docstring'''





	snake_case_		    =     []
	snake_case_		    =     1

	while len(_A							) < 1E6:
		constant.append(str(_A							)							)
		i += 1

	snake_case_		    =     "".join(_A							)

	return (
	    int(constant[0]							)
	    * int(constant[9]							)
	    * int(constant[99]							)
	    * int(constant[999]							)
	    * int(constant[9999]							)
	    * int(constant[99999]							)
	    * int(constant[999999]							)
	)


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