


import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
		import torch

if is_vision_available():
		from PIL import Image

		from transformers import GLPNImageProcessor



class 						_UpperCAmelCase      (     unittest.TestCase							):






		def __init__(						self				:     Optional[Any]   ,  UpperCAmelCase				:     int   ,  UpperCAmelCase				:     int=7   ,  UpperCAmelCase				:     Optional[Any]=3   ,  UpperCAmelCase				:     List[str]=18   ,  UpperCAmelCase				:     Optional[int]=30   ,  UpperCAmelCase				:     str=4_00   ,  UpperCAmelCase				:     List[str]=True   ,  UpperCAmelCase				:     List[Any]=32   ,  UpperCAmelCase				:     List[str]=True   ,  ):
				SCREAMING_SNAKE_CASE_				:Any				     =						parent
				SCREAMING_SNAKE_CASE_				:str				     =						batch_size
				SCREAMING_SNAKE_CASE_				:int				     =						num_channels
				SCREAMING_SNAKE_CASE_				:Tuple				     =						image_size
				SCREAMING_SNAKE_CASE_				:Union[str, Any]				     =						min_resolution
				SCREAMING_SNAKE_CASE_				:List[str]				     =						max_resolution
				SCREAMING_SNAKE_CASE_				:Optional[int]				     =						do_resize
				SCREAMING_SNAKE_CASE_				:List[str]				     =						size_divisor
				SCREAMING_SNAKE_CASE_				:List[str]				     =						do_rescale







		def _snake_case		(						self				:     Tuple):
				return {
				    "do_resize": self.do_resize,
				    "size_divisor": self.size_divisor,
				    "do_rescale": self.do_rescale,
				}




@require_torch
@require_vision
class 						_UpperCAmelCase      (     lowercase		,		unittest.TestCase							):
		lowerCamelCase_	:			Union[str, Any]       			=  GLPNImageProcessor if is_vision_available() else None






		def _snake_case		(						self				:     Optional[int]):
				SCREAMING_SNAKE_CASE_				:Dict				     =						GLPNImageProcessingTester(self)






		@property
		def _snake_case		(						self				:     Any):
				return self.image_processor_tester.prepare_image_processor_dict()






		def _snake_case		(						self				:     Any):
				SCREAMING_SNAKE_CASE_				:List[str]				     =						self.image_processing_class(**self.image_processor_dict)
				self.assertTrue(hasattr(UpperCAmelCase   ,  "do_resize"))
				self.assertTrue(hasattr(UpperCAmelCase   ,  "size_divisor"))
				self.assertTrue(hasattr(UpperCAmelCase   ,  "resample"))
				self.assertTrue(hasattr(UpperCAmelCase   ,  "do_rescale"))






		def _snake_case		(						self				:     Optional[Any]):
				pass






		def _snake_case		(						self				:     Dict):
				# Initialize image_processing
				SCREAMING_SNAKE_CASE_				:Optional[Any]				     =						self.image_processing_class(**self.image_processor_dict)
				# create random PIL images
				SCREAMING_SNAKE_CASE_				:Tuple				     =						prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=UpperCAmelCase)
				for image in image_inputs:
						self.assertIsInstance(UpperCAmelCase   ,  Image.Image)

				# Test not batched input (GLPNImageProcessor doesn't support batching)
				SCREAMING_SNAKE_CASE_				:List[str]				     =						image_processing(image_inputs[0]   ,  return_tensors="pt").pixel_values
				self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
				self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)






		def _snake_case		(						self				:     List[Any]):
				# Initialize image_processing
				SCREAMING_SNAKE_CASE_				:Any				     =						self.image_processing_class(**self.image_processor_dict)
				# create random numpy tensors
				SCREAMING_SNAKE_CASE_				:Dict				     =						prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=UpperCAmelCase   ,  numpify=UpperCAmelCase)
				for image in image_inputs:
						self.assertIsInstance(UpperCAmelCase   ,  np.ndarray)

				# Test not batched input (GLPNImageProcessor doesn't support batching)
				SCREAMING_SNAKE_CASE_				:Any				     =						image_processing(image_inputs[0]   ,  return_tensors="pt").pixel_values
				self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
				self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)







		def _snake_case		(						self				:     Union[str, Any]):
				# Initialize image_processing
				SCREAMING_SNAKE_CASE_				:Dict				     =						self.image_processing_class(**self.image_processor_dict)
				# create random PyTorch tensors
				SCREAMING_SNAKE_CASE_				:int				     =						prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=UpperCAmelCase   ,  torchify=UpperCAmelCase)
				for image in image_inputs:
						self.assertIsInstance(UpperCAmelCase   ,  torch.Tensor)

				# Test not batched input (GLPNImageProcessor doesn't support batching)
				SCREAMING_SNAKE_CASE_				:List[Any]				     =						image_processing(image_inputs[0]   ,  return_tensors="pt").pixel_values
				self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0)
				self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0)










import qiskit


def     lowercase	(    a     , a ):



		'''simple docstring'''




		SCREAMING_SNAKE_CASE_				:int				     =						qiskit.Aer.get_backend("aer_simulator" )

		# Create a Quantum Circuit acting on the q register
		SCREAMING_SNAKE_CASE_				:Union[str, Any]				     =						qiskit.QuantumCircuit(a     , a )

		# Apply X (NOT) Gate to Qubits 0 & 1
		circuit.x(0 )
		circuit.x(1 )

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

		# Execute the circuit on the qasm simulator
		SCREAMING_SNAKE_CASE_				:Any				     =						qiskit.execute(a     , a     , shots=1000 )

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


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






