

'''simple docstring'''

import numpy as np
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from PIL import Image





def 				lowercase (					__magic_name__			,   __magic_name__=256							):



					'''simple docstring'''







					UpperCAmelCase		:							Tuple        =       min(img.size							)

					if s < target_image_size:
										raise ValueError(F"min dim for image {s} < {target_image_size}"							)

					UpperCAmelCase		:							Union[str, Any]        =       target_image_size / s
					UpperCAmelCase		:							Any        =       (round(r * img.size[1]							), round(r * img.size[0]							))
					UpperCAmelCase		:							Union[str, Any]        =       TF.resize(__magic_name__			,   __magic_name__			,   interpolation=PIL.Image.LANCZOS							)
					UpperCAmelCase		:							Union[str, Any]        =       TF.center_crop(__magic_name__			,   output_size=2 * [target_image_size]							)
					UpperCAmelCase		:							List[Any]        =       torch.unsqueeze(T.ToTensor()(__magic_name__							)			,   0							)
					return img





def 				lowercase (					__magic_name__							):



					'''simple docstring'''







					UpperCAmelCase		:							Optional[Any]        =       2.0 * x - 1.0
					return x





def 				lowercase (					__magic_name__			,   __magic_name__=True			,   __magic_name__="RGB"							):



					'''simple docstring'''







					UpperCAmelCase		:							List[Any]        =       x.detach().cpu()
					if process:
										UpperCAmelCase		:							Optional[int]        =       post_process_tensor(__magic_name__							)
					UpperCAmelCase		:							int        =       x.numpy()
					if process:
										UpperCAmelCase		:							Tuple        =       (255 * x).astype(np.uinta							)
					UpperCAmelCase		:							str        =       Image.fromarray(__magic_name__							)
					if not x.mode == mode:
										UpperCAmelCase		:							str        =       x.convert(__magic_name__							)
					return x





def 				lowercase (					__magic_name__							):



					'''simple docstring'''







					UpperCAmelCase		:							Tuple        =       torch.clamp(__magic_name__			,   -1.0			,   1.0							)
					UpperCAmelCase		:							List[Any]        =       (x + 1.0) / 2.0
					UpperCAmelCase		:							Optional[int]        =       x.permute(1			,   2			,   0							)
					return x





def 				lowercase (					__magic_name__							):



					'''simple docstring'''







					UpperCAmelCase		:							int        =       post_process_tensor(x.squeeze()							)
					return x.permute(2			,   0			,   1							).unsqueeze(0							)



'''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)}')
