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




    """simple docstring"""




    def  lowercase					(		self							:     Optional[Any]	,      A_							:     Optional[Any]    )    ->       Dict:
         for model_result in results.values():
              for batch_size, sequence_length in zip(model_result['''bs''']	,      model_result['''ss''']    ):
                   __snake_case				=							model_result['''result'''][batch_size][sequence_length]
                   self.assertIsNotNone(A_    )
    def  lowercase					(		self							:     Optional[Any]    )    ->       Any:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      eager_mode=A_	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     Dict    )    ->       List[str]:
         __snake_case				=							'''sgugger/tiny-distilbert-classification'''
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      only_pretrain_model=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     int    )    ->       str:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     Dict    )    ->       List[str]:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							AutoConfig.from_pretrained(A_    )
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      eager_mode=A_	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_	,      [config]    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     Tuple    )    ->       Dict:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							AutoConfig.from_pretrained(A_    )
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_	,      [config]    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     int    )    ->       Any:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_train_result    )
         self.check_results_dict_not_empty(results.memory_train_result    )
    def  lowercase					(		self							:     str    )    ->       int:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							AutoConfig.from_pretrained(A_    )
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_	,      [config]    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_train_result    )
         self.check_results_dict_not_empty(results.memory_train_result    )
    def  lowercase					(		self							:     Optional[Any]    )    ->       Tuple:
         __snake_case				=							'''patrickvonplaten/t5-tiny-random'''
         __snake_case				=							AutoConfig.from_pretrained(A_    )
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_	,      configs=[config]    )
         __snake_case				=							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  lowercase					(		self							:     str    )    ->       Tuple:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         __snake_case				=							TensorFlowBenchmarkArguments(
             models=[MODEL_ID]	,      training=A_	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      use_xla=A_	,      multi_process=A_	,      )
         __snake_case				=							TensorFlowBenchmark(A_    )
         __snake_case				=							benchmark.run()
         self.check_results_dict_not_empty(results.time_inference_result    )
         self.check_results_dict_not_empty(results.memory_inference_result    )
    def  lowercase					(		self							:     str    )    ->       Tuple:
         __snake_case				=							'''sshleifer/tiny-gpt2'''
         with tempfile.TemporaryDirectory() as tmp_dir:
              __snake_case				=							TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]	,      inference=A_	,      save_to_csv=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      inference_time_csv_file=os.path.join(A_	,      '''inf_time.csv'''    )	,      inference_memory_csv_file=os.path.join(A_	,      '''inf_mem.csv'''    )	,      env_info_csv_file=os.path.join(A_	,      '''env.csv'''    )	,      multi_process=A_	,      )
              __snake_case				=							TensorFlowBenchmark(A_    )
              benchmark.run()
              self.assertTrue(Path(os.path.join(A_	,      '''inf_time.csv'''    )    ).exists()    )
              self.assertTrue(Path(os.path.join(A_	,      '''inf_mem.csv'''    )    ).exists()    )
              self.assertTrue(Path(os.path.join(A_	,      '''env.csv'''    )    ).exists()    )







    def  lowercase					(		self							:     Optional[Any]    )    ->       Dict:
         __snake_case				=							'''sshleifer/tiny-gpt2'''

         def _check_summary_is_not_empty(A_							:     List[str]    ):
              self.assertTrue(hasattr(A_	,      '''sequential'''    )    )
              self.assertTrue(hasattr(A_	,      '''cumulative'''    )    )
              self.assertTrue(hasattr(A_	,      '''current'''    )    )
              self.assertTrue(hasattr(A_	,      '''total'''    )    )

         with tempfile.TemporaryDirectory() as tmp_dir:
              __snake_case				=							TensorFlowBenchmarkArguments(
                  models=[MODEL_ID]	,      inference=A_	,      sequence_lengths=[8]	,      batch_sizes=[1]	,      log_filename=os.path.join(A_	,      '''log.txt'''    )	,      log_print=A_	,      trace_memory_line_by_line=A_	,      eager_mode=A_	,      multi_process=A_	,      )
              __snake_case				=							TensorFlowBenchmark(A_    )
              __snake_case				=							benchmark.run()
              _check_summary_is_not_empty(result.inference_summary    )
              self.assertTrue(Path(os.path.join(A_	,      '''log.txt'''    )    ).exists()    )
"""simple docstring"""



import qiskit





def    SCREAMING_SNAKE_CASE       (     snake_case,      snake_case):
     __snake_case				=							qiskit.Aer.get_backend('''aer_simulator''')

     # Create a Quantum Circuit acting on the q register
     __snake_case				=							qiskit.QuantumCircuit(snake_case,      snake_case)

     # Map the quantum measurement to the classical bits
     circuit.measure([0],      [0])

     # Execute the circuit on the simulator
     __snake_case				=							qiskit.execute(snake_case,      snake_case,      shots=10_00)

     # Return the histogram data of the results of the experiment.
     return job.result().get_counts(snake_case)


if __name__ == "__main__":
       print(F"""Total count for various states are: {single_qubit_measure(1, 1)}""")