


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 PoolFormerImageProcessor






class _lowerCamelCase(		unittest.TestCase  ):
       def __init__(   self, lowerCamelCase, lowerCamelCase=7, lowerCamelCase=3, lowerCamelCase=30, lowerCamelCase=4_00, lowerCamelCase=True, lowerCamelCase=None, lowerCamelCase=0.9, lowerCamelCase=None, lowerCamelCase=True, lowerCamelCase=[0.5, 0.5, 0.5], lowerCamelCase=[0.5, 0.5, 0.5], )			->  Tuple:




           """simple docstring"""

           _lowercase			:				List[Any] 						=						size if size is not None else {'shortest_edge': 30}
           _lowercase			:				Any 						=						crop_size if crop_size is not None else {'height': 30, 'width': 30}
           _lowercase			:				str 						=						parent
           _lowercase			:				Union[str, Any] 						=						batch_size
           _lowercase			:				int 						=						num_channels
           _lowercase			:				Optional[Any] 						=						min_resolution
           _lowercase			:				str 						=						max_resolution
           _lowercase			:				Any 						=						do_resize_and_center_crop
           _lowercase			:				List[str] 						=						size
           _lowercase			:				Optional[Any] 						=						crop_pct
           _lowercase			:				Any 						=						crop_size
           _lowercase			:				Any 						=						do_normalize
           _lowercase			:				Dict 						=						image_mean
           _lowercase			:				Tuple 						=						image_std




       def      UpperCamelCase	(   self)			->  Dict:




           """simple docstring"""

           return {
               "size": self.size,
               "do_resize_and_center_crop": self.do_resize_and_center_crop,
               "crop_pct": self.crop_pct,
               "crop_size": self.crop_size,
               "do_normalize": self.do_normalize,
               "image_mean": self.image_mean,
               "image_std": self.image_std,
           }






@require_torch
@require_vision
class _lowerCamelCase(		_a,					unittest.TestCase  ):
       lowercase_					:      int       					=     PoolFormerImageProcessor if is_vision_available() else None
       def      UpperCamelCase	(   self)			->  int:




           """simple docstring"""

           _lowercase			:				List[Any] 						=						PoolFormerImageProcessingTester(self)
       @property
       def      UpperCamelCase	(   self)			->  str:




           """simple docstring"""

           return self.image_processor_tester.prepare_image_processor_dict()
       def      UpperCamelCase	(   self)			->  int:




           """simple docstring"""

           _lowercase			:				Any 						=						self.image_processing_class(**self.image_processor_dict)
           self.assertTrue(hasattr(lowerCamelCase, 'do_resize_and_center_crop'))
           self.assertTrue(hasattr(lowerCamelCase, 'size'))
           self.assertTrue(hasattr(lowerCamelCase, 'crop_pct'))
           self.assertTrue(hasattr(lowerCamelCase, 'do_normalize'))
           self.assertTrue(hasattr(lowerCamelCase, 'image_mean'))
           self.assertTrue(hasattr(lowerCamelCase, 'image_std'))
       def      UpperCamelCase	(   self)			->  Any:




           """simple docstring"""

           _lowercase			:				int 						=						self.image_processing_class.from_dict(self.image_processor_dict)
           self.assertEqual(image_processor.size, {'shortest_edge': 30})
           self.assertEqual(image_processor.crop_size, {'height': 30, 'width': 30})

           _lowercase			:				Any 						=						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      UpperCamelCase	(   self)			->  Optional[Any]:




           """simple docstring"""

           pass
       def      UpperCamelCase	(   self)			->  str:




           """simple docstring"""

           _lowercase			:				Tuple 						=						self.image_processing_class(**self.image_processor_dict)
           # create random PIL images
           _lowercase			:				str 						=						prepare_image_inputs(self.image_processor_tester, equal_resolution=lowerCamelCase)
           for image in image_inputs:
               self.assertIsInstance(lowerCamelCase, Image.Image)

           # Test not batched input
           _lowercase			:				Union[str, 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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )

           # Test batched
           _lowercase			:				int 						=						image_processing(lowerCamelCase, 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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )
       def      UpperCamelCase	(   self)			->  Union[str, Any]:




           """simple docstring"""

           _lowercase			:				Optional[int] 						=						self.image_processing_class(**self.image_processor_dict)
           # create random numpy tensors
           _lowercase			:				Union[str, Any] 						=						prepare_image_inputs(self.image_processor_tester, equal_resolution=lowerCamelCase, numpify=lowerCamelCase)
           for image in image_inputs:
               self.assertIsInstance(lowerCamelCase, np.ndarray)

           # Test not batched input
           _lowercase			:				Dict 						=						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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )

           # Test batched
           _lowercase			:				Dict 						=						image_processing(lowerCamelCase, 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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )




       def      UpperCamelCase	(   self)			->  Optional[Any]:




           """simple docstring"""

           _lowercase			:				Tuple 						=						self.image_processing_class(**self.image_processor_dict)
           # create random PyTorch tensors
           _lowercase			:				List[str] 						=						prepare_image_inputs(self.image_processor_tester, equal_resolution=lowerCamelCase, torchify=lowerCamelCase)
           for image in image_inputs:
               self.assertIsInstance(lowerCamelCase, torch.Tensor)

           # Test not batched input
           _lowercase			:				List[str] 						=						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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )

           # Test batched
           _lowercase			:				Optional[Any] 						=						image_processing(lowerCamelCase, 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.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               ), )





"""simple docstring"""


import qiskit



def   _A					(	_a	:						int     ,   _a	:						int				):



      """simple docstring"""






      A				  =		qiskit.Aer.get_backend("""aer_simulator"""				)

      # Create a Quantum Circuit acting on the q register
      A				  =		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
      A				  =		qiskit.execute(_a     ,   _a     ,   shots=1_0_0_0				)

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


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




