


'''simple docstring'''
import unittest

import numpy as np

from transformers import AlbertConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
		import jax.numpy as jnp

		from transformers.models.albert.modeling_flax_albert import (
		    FlaxAlbertForMaskedLM,
		    FlaxAlbertForMultipleChoice,
		    FlaxAlbertForPreTraining,
		    FlaxAlbertForQuestionAnswering,
		    FlaxAlbertForSequenceClassification,
		    FlaxAlbertForTokenClassification,
		    FlaxAlbertModel,
		)
class      lowercase			(							unittest.TestCase  ):

		"""simple docstring"""

		def __init__(	self					,     UpperCamelCase_					,     UpperCamelCase_=13					,     UpperCamelCase_=7					,     UpperCamelCase_=True					,     UpperCamelCase_=True					,     UpperCamelCase_=True					,     UpperCamelCase_=True					,     UpperCamelCase_=99					,     UpperCamelCase_=32					,     UpperCamelCase_=5					,     UpperCamelCase_=4					,     UpperCamelCase_=37					,     UpperCamelCase_="gelu"					,     UpperCamelCase_=0.1					,     UpperCamelCase_=0.1					,     UpperCamelCase_=512					,     UpperCamelCase_=16					,     UpperCamelCase_=2					,     UpperCamelCase_=0.02					,     UpperCamelCase_=4					,     ):

							'''simple docstring'''


							UpperCamelCase__     :Optional[Any]							      =				parent
							UpperCamelCase__     :Tuple							      =				batch_size
							UpperCamelCase__     :Tuple							      =				seq_length
							UpperCamelCase__     :Optional[int]							      =				is_training
							UpperCamelCase__     :str							      =				use_attention_mask
							UpperCamelCase__     :Dict							      =				use_token_type_ids
							UpperCamelCase__     :int							      =				use_labels
							UpperCamelCase__     :Optional[Any]							      =				vocab_size
							UpperCamelCase__     :Dict							      =				hidden_size
							UpperCamelCase__     :List[str]							      =				num_hidden_layers
							UpperCamelCase__     :Tuple							      =				num_attention_heads
							UpperCamelCase__     :Optional[int]							      =				intermediate_size
							UpperCamelCase__     :Optional[int]							      =				hidden_act
							UpperCamelCase__     :Optional[int]							      =				hidden_dropout_prob
							UpperCamelCase__     :List[str]							      =				attention_probs_dropout_prob
							UpperCamelCase__     :Any							      =				max_position_embeddings
							UpperCamelCase__     :List[Any]							      =				type_vocab_size
							UpperCamelCase__     :List[Any]							      =				type_sequence_label_size
							UpperCamelCase__     :Optional[int]							      =				initializer_range
							UpperCamelCase__     :List[Any]							      =				num_choices




		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							UpperCamelCase__     :Optional[Any]							      =				ids_tensor([self.batch_size, self.seq_length]					,     self.vocab_size							)

							UpperCamelCase__     :List[Any]							      =				None
							if self.use_attention_mask:
												UpperCamelCase__     :Tuple							      =				random_attention_mask([self.batch_size, self.seq_length]							)

							UpperCamelCase__     :List[str]							      =				None
							if self.use_token_type_ids:
												UpperCamelCase__     :Optional[int]							      =				ids_tensor([self.batch_size, self.seq_length]					,     self.type_vocab_size							)

							UpperCamelCase__     :Tuple							      =				AlbertConfig(
							    vocab_size=self.vocab_size					,     hidden_size=self.hidden_size					,     num_hidden_layers=self.num_hidden_layers					,     num_attention_heads=self.num_attention_heads					,     intermediate_size=self.intermediate_size					,     hidden_act=self.hidden_act					,     hidden_dropout_prob=self.hidden_dropout_prob					,     attention_probs_dropout_prob=self.attention_probs_dropout_prob					,     max_position_embeddings=self.max_position_embeddings					,     type_vocab_size=self.type_vocab_size					,     is_decoder=UpperCamelCase_					,     initializer_range=self.initializer_range					,     )

							return config, input_ids, token_type_ids, attention_mask




		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							UpperCamelCase__     :Union[str, Any]							      =				self.prepare_config_and_inputs()
							UpperCamelCase__     :Any							      =				config_and_inputs
							UpperCamelCase__     :Optional[Any]							      =				{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask}
							return config, inputs_dict



@require_flax
class      lowercase			(							_A			,	unittest.TestCase  ):

		"""simple docstring"""

		_a									=       (
		    (
		        FlaxAlbertModel,
		        FlaxAlbertForPreTraining,
		        FlaxAlbertForMaskedLM,
		        FlaxAlbertForMultipleChoice,
		        FlaxAlbertForQuestionAnswering,
		        FlaxAlbertForSequenceClassification,
		        FlaxAlbertForTokenClassification,
		        FlaxAlbertForQuestionAnswering,
		    )
		    if is_flax_available()
		    else ()
		)




		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							UpperCamelCase__     :Union[str, Any]							      =				FlaxAlbertModelTester(self							)




		@slow
		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							for model_class_name in self.all_model_classes:
												UpperCamelCase__     :Union[str, Any]							      =				model_class_name.from_pretrained('''albert-base-v2'''							)
												UpperCamelCase__     :Any							      =				model(np.ones((1, 1)							)							)
												self.assertIsNotNone(UpperCamelCase_							)



@require_flax
class      lowercase			(							unittest.TestCase  ):

		"""simple docstring"""

		@slow
		def 					lowerCAmelCase__       (	self							):

							'''simple docstring'''


							UpperCamelCase__     :Optional[int]							      =				FlaxAlbertModel.from_pretrained('''albert-base-v2'''							)
							UpperCamelCase__     :Tuple							      =				np.array([[0, 345, 232, 328, 740, 140, 1695, 69, 6078, 1588, 2]]							)
							UpperCamelCase__     :List[Any]							      =				np.array([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]							)
							UpperCamelCase__     :Tuple							      =				model(UpperCamelCase_					,     attention_mask=UpperCamelCase_							)[0]
							UpperCamelCase__     :Optional[int]							      =				(1, 11, 768)
							self.assertEqual(output.shape					,     UpperCamelCase_							)
							UpperCamelCase__     :Tuple							      =				np.array(
							    [[[-0.6513, 1.5035, -0.2766], [-0.6515, 1.5046, -0.2780], [-0.6512, 1.5049, -0.2784]]]							)

							self.assertTrue(jnp.allclose(output[:, 1:4, 1:4]					,     UpperCamelCase_					,     atol=1e-4							)							)



'''simple docstring'''
import qiskit


def     a   (    __a				,      __a     )						->			qiskit.result.counts.Counts:



					'''simple docstring'''






					UpperCamelCase__     :int							      =				qiskit.Aer.get_backend('''aer_simulator'''     )

					# Create a Quantum Circuit acting on the q register
					UpperCamelCase__     :Any							      =				qiskit.QuantumCircuit(__a				,      __a     )

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

					# Execute the circuit on the simulator
					UpperCamelCase__     :Optional[int]							      =				qiskit.execute(__a				,      __a				,      shots=1000     )

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


if __name__ == "__main__":
		print(F"""Total count for various states are: {single_qubit_measure(1, 1)}""")