


'''simple docstring'''


def 			snake_case_   (  SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       List[Any]     		=      1
				_SCREAMING_SNAKE_CASE :       str     		=      2
				while i * i <= n:
								_SCREAMING_SNAKE_CASE :       Tuple     		=      0
								while n % i == 0:
												n //= i
												multiplicity += 1
								n_divisors *= multiplicity + 1
								i += 1
				if n > 1:
								n_divisors *= 2
				return n_divisors







def 			snake_case_   (  ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      1
				_SCREAMING_SNAKE_CASE :       List[Any]     		=      1

				while True:
								i += 1
								t_num += i

								if count_divisors(SCREAMING_SNAKE_CASE__     ) > 500:
												break

				return t_num


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








'''simple docstring'''


import inspect
import unittest

from transformers import RegNetConfig, is_flax_available
from transformers.testing_utils import require_flax, slow
from transformers.utils import cached_property, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor


if is_flax_available():
				import jax
				import jax.numpy as jnp

				from transformers.models.regnet.modeling_flax_regnet import FlaxRegNetForImageClassification, FlaxRegNetModel

if is_vision_available():
				from PIL import Image

				from transformers import AutoImageProcessor





class     lowercase__  (						unittest.TestCase					):





							'''simple docstring'''


							def __init__(    self    ,					__snake_case    ,					__snake_case=3    ,					__snake_case=32    ,					__snake_case=3    ,					__snake_case=10    ,					__snake_case=[10, 20, 30, 40]    ,					__snake_case=[1, 1, 2, 1]    ,					__snake_case=True    ,					__snake_case=True    ,					__snake_case="relu"    ,					__snake_case=3    ,					__snake_case=None    ,					):
											_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      parent
											_SCREAMING_SNAKE_CASE :       Dict     		=      batch_size
											_SCREAMING_SNAKE_CASE :       int     		=      image_size
											_SCREAMING_SNAKE_CASE :       Any     		=      num_channels
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      embeddings_size
											_SCREAMING_SNAKE_CASE :       Tuple     		=      hidden_sizes
											_SCREAMING_SNAKE_CASE :       str     		=      depths
											_SCREAMING_SNAKE_CASE :       str     		=      is_training
											_SCREAMING_SNAKE_CASE :       Any     		=      use_labels
											_SCREAMING_SNAKE_CASE :       Dict     		=      hidden_act
											_SCREAMING_SNAKE_CASE :       int     		=      num_labels
											_SCREAMING_SNAKE_CASE :       str     		=      scope
											_SCREAMING_SNAKE_CASE :       Any     		=      len(__snake_case  )






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]  )

											_SCREAMING_SNAKE_CASE :       Any     		=      self.get_config()

											return config, pixel_values






							def UpperCAmelCase_	(    self  ):
											return RegNetConfig(
											    num_channels=self.num_channels    ,					embeddings_size=self.embeddings_size    ,					hidden_sizes=self.hidden_sizes    ,					depths=self.depths    ,					hidden_act=self.hidden_act    ,					num_labels=self.num_labels    ,					image_size=self.image_size    ,					)






							def UpperCAmelCase_	(    self    ,					__snake_case    ,					__snake_case  ):
											_SCREAMING_SNAKE_CASE :       List[str]     		=      FlaxRegNetModel(config=__snake_case  )
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      model(__snake_case  )

											# Output shape (b, c, h, w)
											self.parent.assertEqual(
											    result.last_hidden_state.shape    ,					(self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32)    ,					)






							def UpperCAmelCase_	(    self    ,					__snake_case    ,					__snake_case  ):
											_SCREAMING_SNAKE_CASE :       Tuple     		=      self.num_labels
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      FlaxRegNetForImageClassification(config=__snake_case  )
											_SCREAMING_SNAKE_CASE :       Tuple     		=      model(__snake_case  )
											self.parent.assertEqual(result.logits.shape    ,					(self.batch_size, self.num_labels)  )






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      self.prepare_config_and_inputs()
											_SCREAMING_SNAKE_CASE		,       _SCREAMING_SNAKE_CASE :       List[Any]     		=      config_and_inputs
											_SCREAMING_SNAKE_CASE :       Dict     		=      {"""pixel_values""": pixel_values}
											return config, inputs_dict





@require_flax
class     lowercase__  (						_snake_case     ,     unittest.TestCase					):





							'''simple docstring'''


							A_							:      Dict      	=  (FlaxRegNetModel, FlaxRegNetForImageClassification) if is_flax_available() else ()

							A_							:      Union[str, Any]      	=  False
							A_							:      List[str]      	=  False
							A_							:      str      	=  False






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       str     		=      FlaxRegNetModelTester(self  )
											_SCREAMING_SNAKE_CASE :       Any     		=      ConfigTester(self    ,					config_class=__snake_case    ,					has_text_modality=__snake_case  )






							def UpperCAmelCase_	(    self  ):
											self.create_and_test_config_common_properties()
											self.config_tester.create_and_test_config_to_json_string()
											self.config_tester.create_and_test_config_to_json_file()
											self.config_tester.create_and_test_config_from_and_save_pretrained()
											self.config_tester.create_and_test_config_with_num_labels()
											self.config_tester.check_config_can_be_init_without_params()
											self.config_tester.check_config_arguments_init()






							def UpperCAmelCase_	(    self  ):
											return






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       int     		=      self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*__snake_case  )






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       Tuple     		=      self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_image_classification(*__snake_case  )






							@unittest.skip(reason="""RegNet does not use inputs_embeds"""  )
							def UpperCAmelCase_	(    self  ):
											pass






							@unittest.skip(reason="""RegNet does not support input and output embeddings"""  )
							def UpperCAmelCase_	(    self  ):
											pass






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE		,       _SCREAMING_SNAKE_CASE :       Optional[Any]     		=      self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
															_SCREAMING_SNAKE_CASE :       List[Any]     		=      model_class(__snake_case  )
															_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      inspect.signature(model.__call__  )
															# signature.parameters is an OrderedDict => so arg_names order is deterministic
															_SCREAMING_SNAKE_CASE :       int     		=      [*signature.parameters.keys()]

															_SCREAMING_SNAKE_CASE :       Tuple     		=      ["""pixel_values"""]
															self.assertListEqual(arg_names[:1]    ,					__snake_case  )






							def UpperCAmelCase_	(    self  ):
											def check_hidden_states_output(__snake_case    ,					__snake_case    ,					__snake_case  ):
															_SCREAMING_SNAKE_CASE :       Any     		=      model_class(__snake_case  )

															_SCREAMING_SNAKE_CASE :       int     		=      model(**self._prepare_for_class(__snake_case    ,					__snake_case  )  )

															_SCREAMING_SNAKE_CASE :       Dict     		=      outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

															_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      self.model_tester.num_stages
															self.assertEqual(len(__snake_case  )    ,					expected_num_stages + 1  )

											_SCREAMING_SNAKE_CASE		,       _SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
															_SCREAMING_SNAKE_CASE :       Optional[int]     		=      True
															check_hidden_states_output(__snake_case    ,					__snake_case    ,					__snake_case  )

															# check that output_hidden_states also work using config
															del inputs_dict["output_hidden_states"]
															_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      True

															check_hidden_states_output(__snake_case    ,					__snake_case    ,					__snake_case  )






							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE		,       _SCREAMING_SNAKE_CASE :       str     		=      self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
															with self.subTest(model_class.__name__  ):
																			_SCREAMING_SNAKE_CASE :       List[Any]     		=      self._prepare_for_class(__snake_case    ,					__snake_case  )
																			_SCREAMING_SNAKE_CASE :       str     		=      model_class(__snake_case  )

																			@jax.jit
																			def model_jitted(__snake_case    ,					**__snake_case  ):
																							return model(pixel_values=__snake_case    ,					**__snake_case  )

																			with self.subTest("""JIT Enabled"""  ):
																							_SCREAMING_SNAKE_CASE :       Any     		=      model_jitted(**__snake_case  ).to_tuple()

																			with self.subTest("""JIT Disabled"""  ):
																							with jax.disable_jit():
																											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      model_jitted(**__snake_case  ).to_tuple()

																			self.assertEqual(len(__snake_case  )    ,					len(__snake_case  )  )
																			for jitted_output, output in zip(__snake_case    ,					__snake_case  ):
																							self.assertEqual(jitted_output.shape    ,					output.shape  )







def 			snake_case_   (  ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       List[str]     		=      Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""     )
				return image







@require_flax
class     lowercase__  (						unittest.TestCase					):





							'''simple docstring'''


							@cached_property
							def UpperCAmelCase_	(    self  ):
											return AutoImageProcessor.from_pretrained("""facebook/regnet-y-040"""  ) if is_vision_available() else None






							@slow
							def UpperCAmelCase_	(    self  ):
											_SCREAMING_SNAKE_CASE :       Any     		=      FlaxRegNetForImageClassification.from_pretrained("""facebook/regnet-y-040"""  )

											_SCREAMING_SNAKE_CASE :       List[Any]     		=      self.default_image_processor
											_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      prepare_img()
											_SCREAMING_SNAKE_CASE :       Tuple     		=      image_processor(images=__snake_case    ,					return_tensors="""np"""  )

											_SCREAMING_SNAKE_CASE :       str     		=      model(**__snake_case  )

											# verify the logits
											_SCREAMING_SNAKE_CASE :       Tuple     		=      (1, 1000)
											self.assertEqual(outputs.logits.shape    ,					__snake_case  )

											_SCREAMING_SNAKE_CASE :       List[Any]     		=      jnp.array([-0.4180, -1.5051, -3.4836]  )

											self.assertTrue(jnp.allclose(outputs.logits[0, :3]    ,					__snake_case    ,					atol=1e-4  )  )




