




import qiskit






def  snake_case(    __magic_name__			,		__magic_name__   )			->							qiskit.result.counts.Counts:
     lowercase :       Tuple       =			qiskit.Aer.get_backend('''aer_simulator'''   )

     lowercase :       Union[str, Any]       =			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
     lowercase :       Any       =			qiskit.execute(__SCREAMING_SNAKE_CASE			,		__SCREAMING_SNAKE_CASE			,		shots=10_00   )

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


if __name__ == "__main__":
 lowerCAmelCase_						=			half_adder(1, 1)
 print(f'''Half Adder Output Qubit Counts: {counts}''')





from typing import Union

import fire
import torch
from tqdm import tqdm






def  snake_case(    __magic_name__			,		__magic_name__ = "cpu"			,		__magic_name__ = None   )			->							None:





     '''simple docstring'''


     lowercase :       int       =			torch.load(__magic_name__			,		map_location=__magic_name__   )
     for k, v in tqdm(state_dict.items()   ):
          if not isinstance(__magic_name__			,		torch.Tensor   ):
               raise TypeError('''FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'''   )
          lowercase :       Any       =			v.half()
     if save_path is None:  # overwrite src_path
          lowercase :       str       =			src_path
     torch.save(__magic_name__			,		__magic_name__   )


if __name__ == "__main__":
 fire.Fire(convert)