





from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
						import numpy as np
						import tensorflow as tf

						from transformers import TFXLMRobertaModel


@require_tf
@require_sentencepiece
@require_tokenizers
class 						lowerCamelCase       (unittest.TestCase      ):







							"""simple docstring"""




							@slow
							def  A_     ( self     :					List[str]						)				->			List[Any]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						TFXLMRobertaModel.from_pretrained("jplu/tf-xlm-roberta-base"						)

														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						{
														    "input_ids": tf.convert_to_tensor([[0, 2_6_4_6, 1_0_2_6_9, 8_3, 9_9_9_4_2, 2]],			dtype=tf.intaa						),  # "My dog is cute"
														    "attention_mask": tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]],			dtype=tf.intaa						),
														}

														SCREAMING_SNAKE_CASE__       :      List[str]     =						model(_UpperCAmelCase						)["last_hidden_state"]
														SCREAMING_SNAKE_CASE__       :      List[str]     =						tf.TensorShape((1, 6, 7_6_8)						)
														self.assertEqual(output.shape,			_UpperCAmelCase						)
														# compare the actual values for a slice.
														SCREAMING_SNAKE_CASE__       :      int     =						tf.convert_to_tensor(
														    [
														        [
														            [0.0681762, 0.10894451, 0.06772504],
														            [-0.06423668, 0.02366615, 0.04329344],
														            [-0.06057295, 0.09974135, -0.00070584],
														        ]
														    ],			dtype=tf.floataa,			)

														self.assertTrue(np.allclose(output[:, :3, :3].numpy(),			expected_slice.numpy(),			atol=1E-4						)						)













import qiskit




def _a (  SCREAMING_SNAKE_CASE__      :  int			,				SCREAMING_SNAKE_CASE__      :  int       )	->    qiskit.result.counts.Counts:

							'''simple docstring'''






							SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						qiskit.Aer.get_backend("aer_simulator"       )

							# Create a Quantum Circuit acting on the q register
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )

							# Apply X (NOT) Gate to Qubits 0 & 1
							circuit.x(0       )
							circuit.x(1       )

							# Map the quantum measurement to the classical bits
							circuit.measure([0, 1]			,				[0, 1]       )

							# Execute the circuit on the qasm simulator
							SCREAMING_SNAKE_CASE__       :      int     =						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 :    List[str]  							= single_qubit_measure(2, 2)
		print(f"Total count for various states are: {counts}")






