'''simple docstring'''

from typing import List, Union

import numpy as np

from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, Pipeline


if is_vision_available():
 from PIL import Image

 from ..image_utils import load_image

if is_torch_available():
 import torch

 from ..models.auto.modeling_auto import MODEL_FOR_DEPTH_ESTIMATION_MAPPING

_A			:      Union[str, Any]					      =				logging.get_logger(__name__)







@add_end_docstrings(UpperCAmelCase__			)
class 				_lowercase     (				UpperCAmelCase__			):


 '''simple docstring'''






 def __init__(      self   :	List[str]      ,       *SCREAMING_SNAKE_CASE__   :	List[Any]      ,       **SCREAMING_SNAKE_CASE__   :	str							)  ->    Any:
  super().__init__(*snake_case_      ,       **snake_case_							)
  requires_backends(self      ,       """vision"""							)
  self.check_model_type(snake_case_							)
 def __call__(      self   :	Dict      ,       SCREAMING_SNAKE_CASE__   :	Dict      ,       **SCREAMING_SNAKE_CASE__   :	List[Any]							)  ->    Tuple:
  return super().__call__(snake_case_      ,       **snake_case_							)
 def a					(      self   :	Optional[Any]      ,       **SCREAMING_SNAKE_CASE__   :	Optional[int]							)  ->    Dict:
  return {}, {}, {}
 def a					(      self   :	List[str]      ,       SCREAMING_SNAKE_CASE__   :	Dict							)  ->    List[str]:
  __lowerCAmelCase											=						load_image(snake_case_							)
  __lowerCAmelCase											=						image.size
  __lowerCAmelCase											=						self.image_processor(images=snake_case_      ,       return_tensors=self.framework							)
  return model_inputs
 def a					(      self   :	str      ,       SCREAMING_SNAKE_CASE__   :	List[Any]							)  ->    Any:
  __lowerCAmelCase											=						self.model(**snake_case_							)
  return model_outputs





 def a					(      self   :	Tuple      ,       SCREAMING_SNAKE_CASE__   :	Union[str, Any]							)  ->    Optional[int]:
  __lowerCAmelCase											=						model_outputs.predicted_depth
  __lowerCAmelCase											=						torch.nn.functional.interpolate(
      predicted_depth.unsqueeze(1							)      ,       size=self.image_size[::-1]      ,       mode="""bicubic"""      ,       align_corners=snake_case_							)
  __lowerCAmelCase											=						prediction.squeeze().cpu().numpy()
  __lowerCAmelCase											=						(output * 2_55 / np.max(snake_case_							)).astype("""uint8"""							)
  __lowerCAmelCase											=						Image.fromarray(snake_case_							)
  __lowerCAmelCase											=						{}
  __lowerCAmelCase											=						predicted_depth
  __lowerCAmelCase											=						depth
  return output_dict













"""simple docstring"""




import qiskit





def 						UpperCAmelCase__		(     _UpperCAmelCase ,					_UpperCAmelCase					):






  """simple docstring"""





  A_  :       Tuple										=  qiskit.Aer.get_backend('aer_simulator'					)

  A_  :       str										=  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
  A_  :       Optional[Any]										=  qiskit.execute(_UpperCAmelCase ,					_UpperCAmelCase ,					shots=1000					)

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


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