


"""simple docstring"""



import os
import tempfile
import unittest
from pathlib import Path

from transformers import AutoConfig, is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
 import tensorflow as tf

 from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments
@require_tf
class 					__magic_name__		(			unittest.TestCase     ):






       def  __snake_case						(   self  :    List[str]  ,     snake_case__  :    Union[str, Any]				):

              '''simple docstring'''






              for model_result in results.values():
                     for batch_size, sequence_length in zip(model_result['''bs''']  ,     model_result['''ss''']				):
                            lowercase		:str       							=				model_result['''result'''][batch_size][sequence_length]
                            self.assertIsNotNone(snake_case__				)






       def  __snake_case						(   self  :    Optional[int]				):

              '''simple docstring'''






              lowercase		:List[Any]       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:Union[str, Any]       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     eager_mode=snake_case__  ,     multi_process=snake_case__  ,     )
              lowercase		:Optional[int]       							=				TensorFlowBenchmark(snake_case__				)
              lowercase		:Dict       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       def  __snake_case						(   self  :    List[Any]				):

              '''simple docstring'''






              lowercase		:str       							=				'''sgugger/tiny-distilbert-classification'''
              lowercase		:int       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     only_pretrain_model=snake_case__  ,     )
              lowercase		:Optional[Any]       							=				TensorFlowBenchmark(snake_case__				)
              lowercase		:str       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       def  __snake_case						(   self  :    Dict				):

              '''simple docstring'''






              lowercase		:str       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:Optional[int]       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     )
              lowercase		:Optional[Any]       							=				TensorFlowBenchmark(snake_case__				)
              lowercase		:str       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       def  __snake_case						(   self  :    Any				):

              '''simple docstring'''






              lowercase		:str       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:List[str]       							=				AutoConfig.from_pretrained(snake_case__				)
              lowercase		:int       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     eager_mode=snake_case__  ,     multi_process=snake_case__  ,     )
              lowercase		:Optional[int]       							=				TensorFlowBenchmark(snake_case__  ,     [config]				)
              lowercase		:Optional[Any]       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       def  __snake_case						(   self  :    List[Any]				):

              '''simple docstring'''






              lowercase		:Tuple       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:Any       							=				AutoConfig.from_pretrained(snake_case__				)
              lowercase		:Tuple       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     )
              lowercase		:Optional[int]       							=				TensorFlowBenchmark(snake_case__  ,     [config]				)
              lowercase		:List[str]       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       def  __snake_case						(   self  :    List[Any]				):

              '''simple docstring'''






              lowercase		:int       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:Optional[int]       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     )
              lowercase		:Optional[int]       							=				TensorFlowBenchmark(snake_case__				)
              lowercase		:str       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_train_result				)
              self.check_results_dict_not_empty(results.memory_train_result				)






       def  __snake_case						(   self  :    List[Any]				):

              '''simple docstring'''






              lowercase		:List[Any]       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:str       							=				AutoConfig.from_pretrained(snake_case__				)
              lowercase		:Union[str, Any]       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     )
              lowercase		:List[Any]       							=				TensorFlowBenchmark(snake_case__  ,     [config]				)
              lowercase		:Optional[Any]       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_train_result				)
              self.check_results_dict_not_empty(results.memory_train_result				)






       def  __snake_case						(   self  :    Any				):

              '''simple docstring'''






              lowercase		:Tuple       							=				'''patrickvonplaten/t5-tiny-random'''
              lowercase		:int       							=				AutoConfig.from_pretrained(snake_case__				)
              lowercase		:List[Any]       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     multi_process=snake_case__  ,     )
              lowercase		:int       							=				TensorFlowBenchmark(snake_case__  ,     configs=[config]				)
              lowercase		:int       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






       @unittest.skipIf(is_tf_available() and len(tf.config.list_physical_devices('''GPU'''				)				) == 0  ,     '''Cannot do xla on CPU.'''				)
       def  __snake_case						(   self  :    Optional[int]				):

              '''simple docstring'''






              lowercase		:str       							=				'''sshleifer/tiny-gpt2'''
              lowercase		:int       							=				TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]  ,     training=snake_case__  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     use_xla=snake_case__  ,     multi_process=snake_case__  ,     )
              lowercase		:Union[str, Any]       							=				TensorFlowBenchmark(snake_case__				)
              lowercase		:Optional[int]       							=				benchmark.run()
              self.check_results_dict_not_empty(results.time_inference_result				)
              self.check_results_dict_not_empty(results.memory_inference_result				)






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

              '''simple docstring'''






              lowercase		:Optional[int]       							=				'''sshleifer/tiny-gpt2'''
              with tempfile.TemporaryDirectory() as tmp_dir:
                     lowercase		:Optional[int]       							=				TensorFlowBenchmarkArguments(
                         models=[MODEL_ID]  ,     inference=snake_case__  ,     save_to_csv=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     inference_time_csv_file=os.path.join(snake_case__  ,     '''inf_time.csv'''				)  ,     inference_memory_csv_file=os.path.join(snake_case__  ,     '''inf_mem.csv'''				)  ,     env_info_csv_file=os.path.join(snake_case__  ,     '''env.csv'''				)  ,     multi_process=snake_case__  ,     )
                     lowercase		:int       							=				TensorFlowBenchmark(snake_case__				)
                     benchmark.run()
                     self.assertTrue(Path(os.path.join(snake_case__  ,     '''inf_time.csv'''				)				).exists()				)
                     self.assertTrue(Path(os.path.join(snake_case__  ,     '''inf_mem.csv'''				)				).exists()				)
                     self.assertTrue(Path(os.path.join(snake_case__  ,     '''env.csv'''				)				).exists()				)







       def  __snake_case						(   self  :    Optional[int]				):

              '''simple docstring'''






              lowercase		:Tuple       							=				'''sshleifer/tiny-gpt2'''

              def _check_summary_is_not_empty(snake_case__  :    Optional[Any]				):
                     self.assertTrue(hasattr(snake_case__  ,     '''sequential'''				)				)
                     self.assertTrue(hasattr(snake_case__  ,     '''cumulative'''				)				)
                     self.assertTrue(hasattr(snake_case__  ,     '''current'''				)				)
                     self.assertTrue(hasattr(snake_case__  ,     '''total'''				)				)

              with tempfile.TemporaryDirectory() as tmp_dir:
                     lowercase		:str       							=				TensorFlowBenchmarkArguments(
                         models=[MODEL_ID]  ,     inference=snake_case__  ,     sequence_lengths=[8]  ,     batch_sizes=[1]  ,     log_filename=os.path.join(snake_case__  ,     '''log.txt'''				)  ,     log_print=snake_case__  ,     trace_memory_line_by_line=snake_case__  ,     eager_mode=snake_case__  ,     multi_process=snake_case__  ,     )
                     lowercase		:List[Any]       							=				TensorFlowBenchmark(snake_case__				)
                     lowercase		:Tuple       							=				benchmark.run()
                     _check_summary_is_not_empty(result.inference_summary				)
                     self.assertTrue(Path(os.path.join(snake_case__  ,     '''log.txt'''				)				).exists()				)





"""simple docstring"""



UpperCAmelCase      		=			{str(digit): digit**5 for digit in range(10)}






def       lowerCamelCase					(a_						:int)     ->							int:
       return sum(DIGITS_FIFTH_POWER[digit] for digit in str(a_))






def       lowerCamelCase					()     ->							int:
       return sum(
           number
           for number in range(1000				,				100_0000)
           if number == digits_fifth_powers_sum(a_))


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

