

'''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_video_inputs


if is_torch_available():
							import torch

if is_vision_available():
							from PIL import Image

							from transformers import VivitImageProcessor





class 		__SCREAMING_SNAKE_CASE							(			unittest.TestCase      ):







				def __init__(       self     :		List[str]		,					UpperCAmelCase__     :		str		,					UpperCAmelCase__     :		Tuple=7		,					UpperCAmelCase__     :		str=3		,					UpperCAmelCase__     :		Union[str, Any]=10		,					UpperCAmelCase__     :		int=18		,					UpperCAmelCase__     :		Optional[int]=30		,					UpperCAmelCase__     :		Dict=400		,					UpperCAmelCase__     :		Union[str, Any]=True		,					UpperCAmelCase__     :		int=None		,					UpperCAmelCase__     :		Optional[int]=True		,					UpperCAmelCase__     :		str=[0.5, 0.5, 0.5]		,					UpperCAmelCase__     :		Optional[Any]=[0.5, 0.5, 0.5]		,					UpperCAmelCase__     :		List[Any]=None		,					):
										'''simple docstring'''
										lowercase :							Optional[Any]    		=size if size is not None else {'''shortest_edge''': 18}
										lowercase :							Union[str, Any]    		=crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}

										lowercase :							List[Any]    		=parent
										lowercase :							Optional[Any]    		=batch_size
										lowercase :							str    		=num_channels
										lowercase :							Any    		=num_frames
										lowercase :							Any    		=image_size
										lowercase :							Optional[Any]    		=min_resolution
										lowercase :							Tuple    		=max_resolution
										lowercase :							Any    		=do_resize
										lowercase :							Optional[int]    		=size
										lowercase :							int    		=do_normalize
										lowercase :							List[str]    		=image_mean
										lowercase :							Union[str, Any]    		=image_std
										lowercase :							int    		=crop_size







				def  lowerCamelCase_	(       self     :		int   ):
										'''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,
										    "crop_size": self.crop_size,
										}





@require_torch
@require_vision
class 		__SCREAMING_SNAKE_CASE							(			lowercase__						,							unittest.TestCase      ):
				lowerCamelCase_		       =    VivitImageProcessor if is_vision_available() else None







				def  lowerCamelCase_	(       self     :		List[Any]   ):
										'''simple docstring'''
										lowercase :							Optional[int]    		=VivitImageProcessingTester(self   )







				@property
				def  lowerCamelCase_	(       self     :		Union[str, Any]   ):
										'''simple docstring'''
										return self.image_processor_tester.prepare_image_processor_dict()







				def  lowerCamelCase_	(       self     :		Union[str, Any]   ):
										'''simple docstring'''
										lowercase :							int    		=self.image_processing_class(**self.image_processor_dict   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''image_mean'''   )   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''image_std'''   )   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''do_normalize'''   )   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''do_resize'''   )   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''do_center_crop'''   )   )
										self.assertTrue(hasattr(UpperCAmelCase__		,					'''size'''   )   )







				def  lowerCamelCase_	(       self     :		Optional[int]   ):
										'''simple docstring'''
										lowercase :							Dict    		=self.image_processing_class.from_dict(self.image_processor_dict   )
										self.assertEqual(image_processor.size		,					{'''shortest_edge''': 18}   )
										self.assertEqual(image_processor.crop_size		,					{'''height''': 18, '''width''': 18}   )

										lowercase :							Dict    		=self.image_processing_class.from_dict(self.image_processor_dict		,					size=42		,					crop_size=84   )
										self.assertEqual(image_processor.size		,					{'''shortest_edge''': 42}   )
										self.assertEqual(image_processor.crop_size		,					{'''height''': 84, '''width''': 84}   )







				def  lowerCamelCase_	(       self     :		int   ):
										'''simple docstring'''
										# Initialize image_processing
										lowercase :							Optional[int]    		=self.image_processing_class(**self.image_processor_dict   )
										# create random PIL videos
										lowercase :							Tuple    		=prepare_video_inputs(self.image_processor_tester		,					equal_resolution=UpperCAmelCase__   )
										for video in video_inputs:
																self.assertIsInstance(UpperCAmelCase__		,					UpperCAmelCase__   )
																self.assertIsInstance(video[0]		,					Image.Image   )

										# Test not batched input
										lowercase :							Union[str, Any]    		=image_processing(video_inputs[0]		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)

										# Test batched
										lowercase :							Optional[int]    		=image_processing(UpperCAmelCase__		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)







				def  lowerCamelCase_	(       self     :		List[str]   ):
										'''simple docstring'''
										# Initialize image_processing
										lowercase :							List[str]    		=self.image_processing_class(**self.image_processor_dict   )
										# create random numpy tensors
										lowercase :							List[Any]    		=prepare_video_inputs(self.image_processor_tester		,					equal_resolution=UpperCAmelCase__		,					numpify=UpperCAmelCase__   )
										for video in video_inputs:
																self.assertIsInstance(UpperCAmelCase__		,					UpperCAmelCase__   )
																self.assertIsInstance(video[0]		,					np.ndarray   )

										# Test not batched input
										lowercase :							Tuple    		=image_processing(video_inputs[0]		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)

										# Test batched
										lowercase :							str    		=image_processing(UpperCAmelCase__		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)







				def  lowerCamelCase_	(       self     :		Any   ):
										'''simple docstring'''
										# Initialize image_processing
										lowercase :							Optional[Any]    		=self.image_processing_class(**self.image_processor_dict   )
										# create random PyTorch tensors
										lowercase :							Optional[int]    		=prepare_video_inputs(self.image_processor_tester		,					equal_resolution=UpperCAmelCase__		,					torchify=UpperCAmelCase__   )
										for video in video_inputs:
																self.assertIsInstance(UpperCAmelCase__		,					UpperCAmelCase__   )
																self.assertIsInstance(video[0]		,					torch.Tensor   )

										# Test not batched input
										lowercase :							str    		=image_processing(video_inputs[0]		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        1,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)

										# Test batched
										lowercase :							Any    		=image_processing(UpperCAmelCase__		,					return_tensors='''pt'''   ).pixel_values
										self.assertEqual(
										    encoded_videos.shape		,					(
										        self.image_processor_tester.batch_size,
										        self.image_processor_tester.num_frames,
										        self.image_processor_tester.num_channels,
										        self.image_processor_tester.crop_size['''height'''],
										        self.image_processor_tester.crop_size['''width'''],
										    )		,					)













'''simple docstring'''







import math

import qiskit


def       __UpperCamelCase					(      lowercase_       :  int = 1   ,       lowercase_       :  int = 1   ,       lowercase_       :  int = 1   ):
       """simple docstring"""




       if (
           isinstance(lowercase_   ,       lowercase_   )
           or isinstance(lowercase_   ,       lowercase_   )
           or isinstance(lowercase_   ,       lowercase_   )
       ):
              raise TypeError('inputs must be integers.'   )

       if (input_a < 0) or (input_a < 0) or (carry_in < 0):
              raise ValueError('inputs must be positive.'   )

       if (
           (math.floor(lowercase_   ) != input_a)
           or (math.floor(lowercase_   ) != input_a)
           or (math.floor(lowercase_   ) != carry_in)
       ):
              raise ValueError('inputs must be exact integers.'   )

       if (input_a > 2) or (input_a > 2) or (carry_in > 2):
              raise ValueError('inputs must be less or equal to 2.'   )

       # build registers
       a_						     =			qiskit.QuantumRegister(4   ,       'qr'   )
       a_						     =			qiskit.ClassicalRegister(2   ,       'cr'   )
       # list the entries
       a_						     =			[input_a, input_a, carry_in]

       a_						     =			qiskit.QuantumCircuit(lowercase_   ,       lowercase_   )

       for i in range(0   ,       3   ):
              if entry[i] == 2:
                     quantum_circuit.h(lowercase_   )  # for hadamard entries
              elif entry[i] == 1:
                     quantum_circuit.x(lowercase_   )  # for 1 entries
              elif entry[i] == 0:
                     quantum_circuit.i(lowercase_   )  # for 0 entries

    # build the circuit
       quantum_circuit.ccx(0   ,       1   ,       3   )  # ccx = toffoli gate
       quantum_circuit.cx(0   ,       1   )
       quantum_circuit.ccx(1   ,       2   ,       3   )
       quantum_circuit.cx(1   ,       2   )
       quantum_circuit.cx(0   ,       1   )

       quantum_circuit.measure([2, 3]   ,       lowercase_   )  # measure the last two qbits

       a_						     =			qiskit.Aer.get_backend('aer_simulator'   )
       a_						     =			qiskit.execute(lowercase_   ,       lowercase_   ,       shots=1_000   )

       return job.result().get_counts(lowercase_   )


if __name__ == "__main__":
  print(f"""Total sum count for state is: {quantum_full_adder(1, 1, 1)}""")




