
"""simple docstring"""

from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    get_resize_output_image_size,
    normalize,
    pad,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    get_image_size,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging
from ...utils.import_utils import is_vision_available


_A            = logging.get_logger(__name__)


if is_vision_available():
					import PIL






class        _lowercase   (				__UpperCAmelCase		):
	lowercase_        =	['pixel_values']




	def __init__( self		, UpperCAmelCase_ = True		, UpperCAmelCase_ = None		, UpperCAmelCase_ = PILImageResampling.BILINEAR		, UpperCAmelCase_ = True		, UpperCAmelCase_ = False		, UpperCAmelCase_ = True		, UpperCAmelCase_ = True		, UpperCAmelCase_ = 1 / 255		, UpperCAmelCase_ = True		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, **UpperCAmelCase_		, )		->							None:
			super().__init__(**UpperCAmelCase_					)

			lowerCamelCase     :			Any		=    size if size is not None else {'height': 2560, 'width': 1920}
			if isinstance(UpperCAmelCase_		, (tuple, list)					):
					# The previous feature extractor size parameter was in (width, height) format
					lowerCamelCase     :			str		=    size[::-1]
			lowerCamelCase     :			int		=    get_size_dict(UpperCAmelCase_					)

			lowerCamelCase     :			Union[str, Any]		=    do_resize
			lowerCamelCase     :			Union[str, Any]		=    size
			lowerCamelCase     :			Dict		=    resample
			lowerCamelCase     :			Optional[Any]		=    do_thumbnail
			lowerCamelCase     :			Any		=    do_align_long_axis
			lowerCamelCase     :			Optional[Any]		=    do_pad
			lowerCamelCase     :			Any		=    do_rescale
			lowerCamelCase     :			Any		=    rescale_factor
			lowerCamelCase     :			List[Any]		=    do_normalize
			lowerCamelCase     :			Optional[int]		=    image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
			lowerCamelCase     :			str		=    image_std if image_std is not None else IMAGENET_STANDARD_STD




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = None					)		->							np.ndarray:
			lowerCamelCase	,    lowerCamelCase     :			Dict		=    get_image_size(UpperCAmelCase_					)
			lowerCamelCase	,    lowerCamelCase     :			Dict		=    size['height'], size['width']

			if (output_width < output_height and input_width > input_height) or (
			    output_width > output_height and input_width < input_height
			):
					lowerCamelCase     :			Union[str, Any]		=    np.rotaa(UpperCAmelCase_		, 3					)

			if data_format is not None:
					lowerCamelCase     :			Union[str, Any]		=    to_channel_dimension_format(UpperCAmelCase_		, UpperCAmelCase_					)

			return image




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = False		, UpperCAmelCase_ = None		, )		->							np.ndarray:
			lowerCamelCase	,    lowerCamelCase     :			Optional[int]		=    size['height'], size['width']
			lowerCamelCase	,    lowerCamelCase     :			List[str]		=    get_image_size(UpperCAmelCase_					)

			lowerCamelCase     :			Any		=    output_width - input_width
			lowerCamelCase     :			Any		=    output_height - input_height

			if random_padding:
					lowerCamelCase     :			Optional[Any]		=    np.random.randint(low=0		, high=delta_height + 1					)
					lowerCamelCase     :			Optional[int]		=    np.random.randint(low=0		, high=delta_width + 1					)
			else:
					lowerCamelCase     :			str		=    delta_height // 2
					lowerCamelCase     :			Optional[Any]		=    delta_width // 2

			lowerCamelCase     :			List[Any]		=    delta_height - pad_top
			lowerCamelCase     :			List[Any]		=    delta_width - pad_left

			lowerCamelCase     :			Optional[int]		=    ((pad_top, pad_bottom), (pad_left, pad_right))
			return pad(UpperCAmelCase_		, UpperCAmelCase_		, data_format=UpperCAmelCase_					)




	def 			_UpperCamelCase    ( self		, *UpperCAmelCase_		, **UpperCAmelCase_					)		->							Optional[Any]:
			logger.info('pad is deprecated and will be removed in version 4.27. Please use pad_image instead.'					)
			return self.pad_image(*UpperCAmelCase_		, **UpperCAmelCase_					)




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = PILImageResampling.BICUBIC		, UpperCAmelCase_ = None		, **UpperCAmelCase_		, )		->							np.ndarray:
			lowerCamelCase	,    lowerCamelCase     :			str		=    get_image_size(UpperCAmelCase_					)
			lowerCamelCase	,    lowerCamelCase     :			Any		=    size['height'], size['width']

			# We always resize to the smallest of either the input or output size.
			lowerCamelCase     :			str		=    min(UpperCAmelCase_		, UpperCAmelCase_					)
			lowerCamelCase     :			Optional[int]		=    min(UpperCAmelCase_		, UpperCAmelCase_					)

			if height == input_height and width == input_width:
					return image

			if input_height > input_width:
					lowerCamelCase     :			str		=    int(input_width * height / input_height					)
			elif input_width > input_height:
					lowerCamelCase     :			Any		=    int(input_height * width / input_width					)

			return resize(
			    UpperCAmelCase_		, size=(height, width)		, resample=UpperCAmelCase_		, reducing_gap=2.0		, data_format=UpperCAmelCase_		, **UpperCAmelCase_					)




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = PILImageResampling.BICUBIC		, UpperCAmelCase_ = None		, **UpperCAmelCase_		, )		->							np.ndarray:
			lowerCamelCase     :			Union[str, Any]		=    get_size_dict(UpperCAmelCase_					)
			lowerCamelCase     :			List[Any]		=    min(size['height']		, size['width']					)
			lowerCamelCase     :			Optional[int]		=    get_resize_output_image_size(UpperCAmelCase_		, size=UpperCAmelCase_		, default_to_square=UpperCAmelCase_					)
			lowerCamelCase     :			Any		=    resize(UpperCAmelCase_		, size=UpperCAmelCase_		, resample=UpperCAmelCase_		, data_format=UpperCAmelCase_		, **UpperCAmelCase_					)
			return resized_image




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = None		, **UpperCAmelCase_		, )		->							Optional[int]:
			return rescale(UpperCAmelCase_		, scale=UpperCAmelCase_		, data_format=UpperCAmelCase_		, **UpperCAmelCase_					)




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_		, UpperCAmelCase_ = None		, **UpperCAmelCase_		, )		->							np.ndarray:
			return normalize(UpperCAmelCase_		, mean=UpperCAmelCase_		, std=UpperCAmelCase_		, data_format=UpperCAmelCase_		, **UpperCAmelCase_					)




	def 			_UpperCamelCase    ( self		, UpperCAmelCase_		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = False		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = None		, UpperCAmelCase_ = ChannelDimension.FIRST		, **UpperCAmelCase_		, )		->							PIL.Image.Image:
			lowerCamelCase     :			str		=    do_resize if do_resize is not None else self.do_resize
			lowerCamelCase     :			Optional[Any]		=    size if size is not None else self.size
			if isinstance(UpperCAmelCase_		, (tuple, list)					):
					# Previous feature extractor had size in (width, height) format
					lowerCamelCase     :			str		=    size[::-1]
			lowerCamelCase     :			Union[str, Any]		=    get_size_dict(UpperCAmelCase_					)
			lowerCamelCase     :			Any		=    resample if resample is not None else self.resample
			lowerCamelCase     :			Optional[int]		=    do_thumbnail if do_thumbnail is not None else self.do_thumbnail
			lowerCamelCase     :			Dict		=    do_align_long_axis if do_align_long_axis is not None else self.do_align_long_axis
			lowerCamelCase     :			Union[str, Any]		=    do_pad if do_pad is not None else self.do_pad
			lowerCamelCase     :			Dict		=    do_rescale if do_rescale is not None else self.do_rescale
			lowerCamelCase     :			Dict		=    rescale_factor if rescale_factor is not None else self.rescale_factor
			lowerCamelCase     :			Union[str, Any]		=    do_normalize if do_normalize is not None else self.do_normalize
			lowerCamelCase     :			Union[str, Any]		=    image_mean if image_mean is not None else self.image_mean
			lowerCamelCase     :			Optional[Any]		=    image_std if image_std is not None else self.image_std

			lowerCamelCase     :			Dict		=    make_list_of_images(UpperCAmelCase_					)

			if not valid_images(UpperCAmelCase_					):
					raise ValueError(
					    'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
					    'torch.Tensor, tf.Tensor or jax.ndarray.'					)

			if do_resize and size is None:
					raise ValueError('Size must be specified if do_resize is True.'					)

			if do_rescale and rescale_factor is None:
					raise ValueError('Rescale factor must be specified if do_rescale is True.'					)

			if do_pad and size is None:
					raise ValueError('Size must be specified if do_pad is True.'					)

			if do_normalize and (image_mean is None or image_std is None):
					raise ValueError('Image mean and std must be specified if do_normalize is True.'					)

			# All transformations expect numpy arrays.
			lowerCamelCase     :			List[str]		=    [to_numpy_array(UpperCAmelCase_					) for image in images]

			if do_align_long_axis:
					lowerCamelCase     :			int		=    [self.align_long_axis(UpperCAmelCase_		, size=UpperCAmelCase_					) for image in images]

			if do_resize:
					lowerCamelCase     :			List[Any]		=    [self.resize(image=UpperCAmelCase_		, size=UpperCAmelCase_		, resample=UpperCAmelCase_					) for image in images]

			if do_thumbnail:
					lowerCamelCase     :			List[str]		=    [self.thumbnail(image=UpperCAmelCase_		, size=UpperCAmelCase_					) for image in images]

			if do_pad:
					lowerCamelCase     :			Union[str, Any]		=    [self.pad_image(image=UpperCAmelCase_		, size=UpperCAmelCase_		, random_padding=UpperCAmelCase_					) for image in images]

			if do_rescale:
					lowerCamelCase     :			List[str]		=    [self.rescale(image=UpperCAmelCase_		, scale=UpperCAmelCase_					) for image in images]

			if do_normalize:
					lowerCamelCase     :			Optional[Any]		=    [self.normalize(image=UpperCAmelCase_		, mean=UpperCAmelCase_		, std=UpperCAmelCase_					) for image in images]

			lowerCamelCase     :			str		=    [to_channel_dimension_format(UpperCAmelCase_		, UpperCAmelCase_					) for image in images]

			lowerCamelCase     :			Optional[int]		=    {'pixel_values': images}
			return BatchFeature(data=UpperCAmelCase_		, tensor_type=UpperCAmelCase_					)












import math

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




def 					SCREAMING_SNAKE_CASE	(       __UpperCamelCase			:						int = 1       ,     __UpperCamelCase			:						int = 1      )  ->							qiskit.result.counts.Counts:
    if isinstance(__UpperCamelCase       ,     __UpperCamelCase      ) or isinstance(__UpperCamelCase       ,     __UpperCamelCase      ):
        raise TypeError('''inputs must be integers.'''      )
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError('''inputs must be positive.'''      )
    if (math.floor(__UpperCamelCase      ) != bit_a) or (math.floor(__UpperCamelCase      ) != 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_							 =     QuantumRegister(2       ,     '''qr'''      )
    UpperCAmelCase_							 =     ClassicalRegister(2       ,     '''cr'''      )

    UpperCAmelCase_							 =     QuantumCircuit(__UpperCamelCase       ,     __UpperCamelCase      )

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

    # send the information
    UpperCAmelCase_							 =     str(__UpperCamelCase      ) + str(__UpperCamelCase      )

    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(__UpperCamelCase       ,     __UpperCamelCase      )

    UpperCAmelCase_							 =     Aer.get_backend('''aer_simulator'''      )
    UpperCAmelCase_							 =     execute(__UpperCamelCase       ,     __UpperCamelCase       ,     shots=1000      )

    return job.result().get_counts(__UpperCamelCase      )


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





