




'''simple docstring'''

import qiskit


def 		__magic_name__    (	__UpperCAmelCase,      __UpperCAmelCase	)		->					qiskit.result.counts.Counts:

					'''simple docstring'''

					snake_case_									=				qiskit.Aer.get_backend('''aer_simulator'''	)

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

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

					# Execute the circuit on the simulator
					snake_case_									=				qiskit.execute(__UpperCAmelCase,      __UpperCAmelCase,      shots=1000	)

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


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



import random
import unittest

import torch

from diffusers import IFInpaintingPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import (
    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_INPAINTING_PARAMS,
)
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin


@skip_mps
class 				lowercase					(		_SCREAMING_SNAKE_CASE  ,   _SCREAMING_SNAKE_CASE  ,   unittest.TestCase   ):
		__lowercase       :       int	     =				IFInpaintingPipeline
		__lowercase       :       str	     =				TEXT_GUIDED_IMAGE_INPAINTING_PARAMS - {"width", "height"}
		__lowercase       :       Optional[int]	     =				TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS
		__lowercase       :       Optional[int]	     =				PipelineTesterMixin.required_optional_params - {"latents"}



		def __UpperCamelCase ( self       )  ->					List[str]:
				"""simple docstring"""
				return self._get_dummy_components()



		def __UpperCamelCase ( self				,      A_				,      A_=0       )  ->					List[Any]:
				"""simple docstring"""
				if str(A_       ).startswith('mps'       ):
						UpperCamelCase		=     torch.manual_seed(A_       )
				else:
						UpperCamelCase		=     torch.Generator(device=A_       ).manual_seed(A_       )

				UpperCamelCase		=     floats_tensor((1, 3, 32, 32)				,      rng=random.Random(A_       )       ).to(A_       )
				UpperCamelCase		=     floats_tensor((1, 3, 32, 32)				,      rng=random.Random(A_       )       ).to(A_       )

				UpperCamelCase		=     {
				    'prompt': 'A painting of a squirrel eating a burger',
				    'image': image,
				    'mask_image': mask_image,
				    'generator': generator,
				    'num_inference_steps': 2,
				    'output_type': 'numpy',
				}

				return inputs



		@unittest.skipIf(
		    torch_device != 'cuda' or not is_xformers_available()				,      reason='XFormers attention is only available with CUDA and `xformers` installed'				,      )
		def __UpperCamelCase ( self       )  ->					str:
				"""simple docstring"""
				self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3       )



		def __UpperCamelCase ( self       )  ->					str:
				"""simple docstring"""
				self._test_save_load_optional_components()



		@unittest.skipIf(torch_device != 'cuda'				,      reason='float16 requires CUDA'       )
		def __UpperCamelCase ( self       )  ->					str:
				"""simple docstring"""
				# Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
				super().test_save_load_floataa(expected_max_diff=1e-1       )



		def __UpperCamelCase ( self       )  ->					Optional[Any]:
				"""simple docstring"""
				self._test_attention_slicing_forward_pass(expected_max_diff=1e-2       )



		def __UpperCamelCase ( self       )  ->					Dict:
				"""simple docstring"""
				self._test_save_load_local()



		def __UpperCamelCase ( self       )  ->					Dict:
				"""simple docstring"""
				self._test_inference_batch_single_identical(
				    expected_max_diff=1e-2				,      )
