


from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Dict    = ['''image_processor''', '''tokenizer''']
   a_				:							Optional[Any]    = '''BlipImageProcessor'''
   a_				:							str    = '''AutoTokenizer'''

   def __init__(  self  : List[str]       ,  _lowerCamelCase  : List[Any]       ,  _lowerCamelCase  : List[str]							):






         '''simple docstring'''



         __lowerCamelCase     :      List[Any]       						=						False
         super().__init__(A__       ,  A__							)
         __lowerCamelCase     :      Optional[Any]       						=						self.image_processor

   def __call__(  self  : Optional[int]       ,  _lowerCamelCase  : Optional[Any] = None       ,  _lowerCamelCase  : List[Any] = None       ,  _lowerCamelCase  : List[str] = True       ,  _lowerCamelCase  : str = False       ,  _lowerCamelCase  : Any = None       ,  _lowerCamelCase  : Optional[Any] = None       ,  _lowerCamelCase  : List[str] = 0       ,  _lowerCamelCase  : Union[str, Any] = None       ,  _lowerCamelCase  : Dict = None       ,  _lowerCamelCase  : Optional[Any] = False       ,  _lowerCamelCase  : List[str] = False       ,  _lowerCamelCase  : List[str] = False       ,  _lowerCamelCase  : List[Any] = False       ,  _lowerCamelCase  : Tuple = False       ,  _lowerCamelCase  : Optional[Any] = True       ,  _lowerCamelCase  : str = None       ,  **_lowerCamelCase  : Union[str, Any]       ,  ):






         '''simple docstring'''



         if images is None and text is None:
               raise ValueError("""You have to specify either images or text."""							)

         # Get only text
         if images is None:
               __lowerCamelCase     :      Optional[int]       						=						self.tokenizer
               __lowerCamelCase     :      int       						=						self.tokenizer(
                   text=A__       ,  add_special_tokens=A__       ,  padding=A__       ,  truncation=A__       ,  max_length=A__       ,  stride=A__       ,  pad_to_multiple_of=A__       ,  return_attention_mask=A__       ,  return_overflowing_tokens=A__       ,  return_special_tokens_mask=A__       ,  return_offsets_mapping=A__       ,  return_token_type_ids=A__       ,  return_length=A__       ,  verbose=A__       ,  return_tensors=A__       ,  **A__       ,  )
               return text_encoding

         # add pixel_values
         __lowerCamelCase     :      Union[str, Any]       						=						self.image_processor(A__       ,  return_tensors=A__							)

         if text is not None:
               __lowerCamelCase     :      Tuple       						=						self.tokenizer(
                   text=A__       ,  add_special_tokens=A__       ,  padding=A__       ,  truncation=A__       ,  max_length=A__       ,  stride=A__       ,  pad_to_multiple_of=A__       ,  return_attention_mask=A__       ,  return_overflowing_tokens=A__       ,  return_special_tokens_mask=A__       ,  return_offsets_mapping=A__       ,  return_token_type_ids=A__       ,  return_length=A__       ,  verbose=A__       ,  return_tensors=A__       ,  **A__       ,  )
         else:
               __lowerCamelCase     :      List[str]       						=						None

         if text_encoding is not None:
               encoding_image_processor.update(A__							)

         return encoding_image_processor

   def   _snake_case    (  self  : List[Any]       ,  *_lowerCamelCase  : Union[str, Any]       ,  **_lowerCamelCase  : Optional[int]							):






         '''simple docstring'''



         return self.tokenizer.batch_decode(*A__       ,  **A__							)

   def   _snake_case    (  self  : Tuple       ,  *_lowerCamelCase  : Dict       ,  **_lowerCamelCase  : List[str]							):






         '''simple docstring'''



         return self.tokenizer.decode(*A__       ,  **A__							)


   @property
   # Copied from transformers.models.blip.processing_blip.BlipProcessor.model_input_names
   def   _snake_case    (  self  : Optional[int]							):






         '''simple docstring'''



         __lowerCamelCase     :      str       						=						self.tokenizer.model_input_names
         __lowerCamelCase     :      Union[str, Any]       						=						self.image_processor.model_input_names
         return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)






import qiskit





def   _UpperCAmelCase       (     UpperCAmelCase      :			int						,	UpperCAmelCase      :			int      ):
      """simple docstring"""




      __lowerCamelCase     :      Dict       						=						qiskit.Aer.get_backend("""aer_simulator"""      )

      __lowerCamelCase     :      Dict       						=						qiskit.QuantumCircuit(4						,	2      )
      # encode inputs in qubits 0 and 1
      if bita == 1:
            qc_ha.x(0      )
      if bita == 1:
            qc_ha.x(1      )
      qc_ha.barrier()

      # use cnots to write XOR of the inputs on qubit2
      qc_ha.cx(0						,	2      )
      qc_ha.cx(1						,	2      )

      # use ccx / toffoli gate to write AND of the inputs on qubit3
      qc_ha.ccx(0						,	1						,	3      )
      qc_ha.barrier()

      # extract outputs
      qc_ha.measure(2						,	0      )  # extract XOR value
      qc_ha.measure(3						,	1      )  # extract AND value

      # Execute the circuit on the qasm simulator
      __lowerCamelCase     :      str       						=						qiskit.execute(UpperCAmelCase						,	UpperCAmelCase						,	shots=1_000      )

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


if __name__ == "__main__":
    __UpperCamelCase    :						List[str]     =							half_adder(1, 1)
    print(F'''Half Adder Output Qubit Counts: {counts}''')



