

'''simple docstring'''

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 ViTImageProcessor







class   UpperCamelCase__   (       unittest.TestCase       ):


		"""simple docstring"""

		def __init__(			self   ,      snake_case   ,      snake_case=7   ,      snake_case=3   ,      snake_case=1_8   ,      snake_case=3_0   ,      snake_case=4_0_0   ,      snake_case=True   ,      snake_case=None   ,      snake_case=True   ,      snake_case=[0.5, 0.5, 0.5]   ,      snake_case=[0.5, 0.5, 0.5]   ,      ):


							'''simple docstring'''

							UpperCAmelCase		:							Union[str, Any]        =       size if size is not None else {"height": 1_8, "width": 1_8}
							UpperCAmelCase		:							List[Any]        =       parent
							UpperCAmelCase		:							str        =       batch_size
							UpperCAmelCase		:							Dict        =       num_channels
							UpperCAmelCase		:							str        =       image_size
							UpperCAmelCase		:							Dict        =       min_resolution
							UpperCAmelCase		:							Dict        =       max_resolution
							UpperCAmelCase		:							List[str]        =       do_resize
							UpperCAmelCase		:							List[Any]        =       size
							UpperCAmelCase		:							Optional[int]        =       do_normalize
							UpperCAmelCase		:							Tuple        =       image_mean
							UpperCAmelCase		:							Union[str, Any]        =       image_std







		def 				A_	(			self      ):


							'''simple docstring'''

							return {
							    "image_mean": self.image_mean,
							    "image_std": self.image_std,
							    "do_normalize": self.do_normalize,
							    "do_resize": self.do_resize,
							    "size": self.size,
							}







@require_torch
@require_vision
class   UpperCamelCase__   (       lowercase__							,							unittest.TestCase       ):


		"""simple docstring"""

		SCREAMING_SNAKE_CASE__  :     str       =							ViTImageProcessor if is_vision_available() else None







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							List[str]        =       ViTImageProcessingTester(self      )







		@property
		def 				A_	(			self      ):


							'''simple docstring'''

							return self.image_processor_tester.prepare_image_processor_dict()







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							Any        =       self.image_processing_class(**self.image_processor_dict      )
							self.assertTrue(hasattr(snake_case   ,      "image_mean"      )      )
							self.assertTrue(hasattr(snake_case   ,      "image_std"      )      )
							self.assertTrue(hasattr(snake_case   ,      "do_normalize"      )      )
							self.assertTrue(hasattr(snake_case   ,      "do_resize"      )      )
							self.assertTrue(hasattr(snake_case   ,      "size"      )      )







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							Optional[int]        =       self.image_processing_class.from_dict(self.image_processor_dict      )
							self.assertEqual(image_processor.size   ,      {"height": 1_8, "width": 1_8}      )

							UpperCAmelCase		:							List[Any]        =       self.image_processing_class.from_dict(self.image_processor_dict   ,      size=4_2      )
							self.assertEqual(image_processor.size   ,      {"height": 4_2, "width": 4_2}      )







		def 				A_	(			self      ):


							'''simple docstring'''

							pass







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							Dict        =       self.image_processing_class(**self.image_processor_dict      )
							# create random PIL images
							UpperCAmelCase		:							int        =       prepare_image_inputs(self.image_processor_tester   ,      equal_resolution=snake_case      )
							for image in image_inputs:
												self.assertIsInstance(snake_case   ,      Image.Image      )

							# Test not batched input
							UpperCAmelCase		:							int        =       image_processing(image_inputs[0]   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )

							# Test batched
							UpperCAmelCase		:							Optional[int]        =       image_processing(snake_case   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							Dict        =       self.image_processing_class(**self.image_processor_dict      )
							# create random numpy tensors
							UpperCAmelCase		:							Optional[int]        =       prepare_image_inputs(self.image_processor_tester   ,      equal_resolution=snake_case   ,      numpify=snake_case      )
							for image in image_inputs:
												self.assertIsInstance(snake_case   ,      np.ndarray      )

							# Test not batched input
							UpperCAmelCase		:							Optional[Any]        =       image_processing(image_inputs[0]   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )

							# Test batched
							UpperCAmelCase		:							Dict        =       image_processing(snake_case   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )







		def 				A_	(			self      ):


							'''simple docstring'''

							UpperCAmelCase		:							str        =       self.image_processing_class(**self.image_processor_dict      )
							# create random PyTorch tensors
							UpperCAmelCase		:							Any        =       prepare_image_inputs(self.image_processor_tester   ,      equal_resolution=snake_case   ,      torchify=snake_case      )
							for image in image_inputs:
												self.assertIsInstance(snake_case   ,      torch.Tensor      )

							# Test not batched input
							UpperCAmelCase		:							List[Any]        =       image_processing(image_inputs[0]   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        1,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )

							# Test batched
							UpperCAmelCase		:							Optional[int]        =       image_processing(snake_case   ,      return_tensors="pt"      ).pixel_values
							self.assertEqual(
							    encoded_images.shape   ,      (
							        self.image_processor_tester.batch_size,
							        self.image_processor_tester.num_channels,
							        self.image_processor_tester.size["height"],
							        self.image_processor_tester.size["width"],
							    )   ,      )



'''simple docstring'''

import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def 				lowercase (					__magic_name__ = 1			,   __magic_name__ = 1							):



					'''simple docstring'''







					if isinstance(__magic_name__			,   __magic_name__							) or isinstance(__magic_name__			,   __magic_name__							):
										raise TypeError("inputs must be integers."							)
					if (bit_a < 0) or (bit_a < 0):
										raise ValueError("inputs must be positive."							)
					if (math.floor(__magic_name__							) != bit_a) or (math.floor(__magic_name__							) != bit_a):
										raise ValueError("inputs must be exact integers."							)
					if (bit_a > 1) or (bit_a > 1):
										raise ValueError("inputs must be less or equal to 1."							)

					# build registers
					UpperCAmelCase		:							List[Any]        =       QuantumRegister(2			,   "qr"							)
					UpperCAmelCase		:							Optional[int]        =       ClassicalRegister(2			,   "cr"							)

					UpperCAmelCase		:							Optional[int]        =       QuantumCircuit(__magic_name__			,   __magic_name__							)

					# entanglement the qubits
					quantum_circuit.h(1							)
					quantum_circuit.cx(1			,   0							)

					# send the information
					UpperCAmelCase		:							Any        =       str(__magic_name__							) + str(__magic_name__							)

					if c_information == "11":
										quantum_circuit.x(1							)
										quantum_circuit.z(1							)
					elif c_information == "10":
										quantum_circuit.z(1							)
					elif c_information == "01":
										quantum_circuit.x(1							)
					else:
										quantum_circuit.i(1							)

					# unentangled the circuit
					quantum_circuit.cx(1			,   0							)
					quantum_circuit.h(1							)

					# measure the circuit
					quantum_circuit.measure(__magic_name__			,   __magic_name__							)

					UpperCAmelCase		:							Tuple        =       Aer.get_backend("aer_simulator"							)
					UpperCAmelCase		:							Any        =       execute(__magic_name__			,   __magic_name__			,   shots=1000							)

					return job.result().get_counts(__magic_name__							)


if __name__ == "__main__":
				print(F'Counts for classical state send: {superdense_coding(1,1)}')
