




import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
def        __lowerCAmelCase (UpperCAmelCase_ = 1   ,    UpperCAmelCase_ = 1		):
    if isinstance(UpperCAmelCase_   ,    UpperCAmelCase_		) or isinstance(UpperCAmelCase_   ,    UpperCAmelCase_		):
        raise TypeError("""inputs must be integers."""		)
    if (bit_a < 0) or (bit_a < 0):
        raise ValueError("""inputs must be positive."""		)
    if (math.floor(UpperCAmelCase_		) != bit_a) or (math.floor(UpperCAmelCase_		) != bit_a):
        raise ValueError("""inputs must be exact integers."""		)
    if (bit_a > 1) or (bit_a > 1):
        raise ValueError("""inputs must be less or equal to 1."""		)

    # build registers
    a__      =       QuantumRegister(2   ,    """qr"""		)
    a__      =       ClassicalRegister(2   ,    """cr"""		)

    a__      =       QuantumCircuit(UpperCAmelCase_   ,    UpperCAmelCase_		)

    # entanglement the qubits
    quantum_circuit.h(1		)
    quantum_circuit.cx(1   ,    0		)

    # send the information
    a__      =       str(UpperCAmelCase_		) + str(UpperCAmelCase_		)

    if c_information == "11":
        quantum_circuit.x(1		)
        quantum_circuit.z(1		)
    elif c_information == "10":
        quantum_circuit.z(1		)
    elif c_information == "01":
        quantum_circuit.x(1		)
    else:
        quantum_circuit.i(1		)

    # unentangled the circuit
    quantum_circuit.cx(1   ,    0		)
    quantum_circuit.h(1		)

    # measure the circuit
    quantum_circuit.measure(UpperCAmelCase_   ,    UpperCAmelCase_		)

    a__      =       Aer.get_backend("""aer_simulator"""		)
    a__      =       execute(UpperCAmelCase_   ,    UpperCAmelCase_   ,    shots=1_000		)

    return job.result().get_counts(UpperCAmelCase_		)


if __name__ == "__main__":
 print(F"Counts for classical state send: {superdense_coding(1,1)}")












import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
 import torch

 from transformers import CamembertModel







@require_torch
@require_sentencepiece
@require_tokenizers
class 		__UpperCAmelCase(		unittest.TestCase ):





     """simple docstring"""



     @slow
     def 				__SCREAMING_SNAKE_CASE		(      self :       Tuple    )			->			List[Any]:






         """simple docstring"""
         a__      =       CamembertModel.from_pretrained("""camembert-base"""    )
         model.to(A    )

         a__      =       torch.tensor(
             [[5, 1_21, 11, 6_60, 16, 7_30, 2_55_43, 1_10, 83, 6]]						,				device=A						,				dtype=torch.long						,				)  # J'aime le camembert !
         with torch.no_grad():
             a__      =       model(A    )["""last_hidden_state"""]
         a__      =       torch.Size((1, 10, 7_68)    )
         self.assertEqual(output.shape						,				A    )
         # compare the actual values for a slice.
         a__      =       torch.tensor(
             [[[-0.0_2_5_4, 0.0_2_3_5, 0.1_0_2_7], [0.0_6_0_6, -0.1_8_1_1, -0.0_4_1_8], [-0.1_5_6_1, -0.1_1_2_7, 0.2_6_8_7]]]						,				device=A						,				dtype=torch.float						,				)
         # camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
         # camembert.eval()
         # expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

         self.assertTrue(torch.allclose(output[:, :3, :3]						,				A						,				atol=1E-4    )    )






