


from ...configuration_utils import PretrainedConfig
from ...utils import logging


__UpperCamelCase    :						Dict     =							logging.get_logger(__name__)

__UpperCamelCase    :						Any     =							{
    'microsoft/trocr-base-handwritten': (
        'https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json'
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}



class 							_UpperCamelCase (						__lowerCamelCase						):

   '''simple docstring'''







   a_				:							Optional[Any]    = "trocr"
   a_				:							Union[str, Any]    = ["past_key_values"]
   a_				:							str    = {
       "num_attention_heads": "decoder_attention_heads",
       "hidden_size": "d_model",
       "num_hidden_layers": "decoder_layers",
   }

   def __init__(  self  : Any       ,  _lowerCamelCase  : Tuple=5_0_2_6_5       ,  _lowerCamelCase  : List[Any]=1_0_2_4       ,  _lowerCamelCase  : Optional[Any]=1_2       ,  _lowerCamelCase  : Dict=1_6       ,  _lowerCamelCase  : str=4_0_9_6       ,  _lowerCamelCase  : int="gelu"       ,  _lowerCamelCase  : List[Any]=5_1_2       ,  _lowerCamelCase  : Dict=0.1       ,  _lowerCamelCase  : Tuple=0.0       ,  _lowerCamelCase  : Dict=0.0       ,  _lowerCamelCase  : Optional[Any]=2       ,  _lowerCamelCase  : Optional[int]=0.02       ,  _lowerCamelCase  : Any=0.0       ,  _lowerCamelCase  : List[str]=True       ,  _lowerCamelCase  : Optional[int]=False       ,  _lowerCamelCase  : Dict=True       ,  _lowerCamelCase  : Tuple=True       ,  _lowerCamelCase  : int=1       ,  _lowerCamelCase  : Any=0       ,  _lowerCamelCase  : List[Any]=2       ,  **_lowerCamelCase  : Optional[Any]       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Tuple       						=						vocab_size
         __lowerCamelCase     :      int       						=						d_model
         __lowerCamelCase     :      Dict       						=						decoder_layers
         __lowerCamelCase     :      Any       						=						decoder_attention_heads
         __lowerCamelCase     :      List[Any]       						=						decoder_ffn_dim
         __lowerCamelCase     :      Any       						=						activation_function
         __lowerCamelCase     :      Union[str, Any]       						=						max_position_embeddings
         __lowerCamelCase     :      List[Any]       						=						dropout
         __lowerCamelCase     :      List[str]       						=						attention_dropout
         __lowerCamelCase     :      Tuple       						=						activation_dropout
         __lowerCamelCase     :      Optional[Any]       						=						init_std
         __lowerCamelCase     :      Any       						=						decoder_layerdrop
         __lowerCamelCase     :      List[str]       						=						use_cache
         __lowerCamelCase     :      Any       						=						scale_embedding
         __lowerCamelCase     :      Dict       						=						use_learned_position_embeddings
         __lowerCamelCase     :      Optional[int]       						=						layernorm_embedding

         super().__init__(
             pad_token_id=SCREAMING_SNAKE_CASE_       ,  bos_token_id=SCREAMING_SNAKE_CASE_       ,  eos_token_id=SCREAMING_SNAKE_CASE_       ,  decoder_start_token_id=SCREAMING_SNAKE_CASE_       ,  **SCREAMING_SNAKE_CASE_       ,  )






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}''')



