






'''simple docstring'''




from collections import OrderedDict
from typing import Any, Mapping, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...feature_extraction_utils import FeatureExtractionMixin
from ...onnx import OnnxConfig
from ...onnx.utils import compute_effective_axis_dimension
from ...tokenization_utils_base import PreTrainedTokenizerBase
from ...utils import TensorType, logging


lowerCamelCase_												=					logging.get_logger(__name__)

lowerCamelCase_												=					{
    '''deepmind/language-perceiver''': '''https://huggingface.co/deepmind/language-perceiver/resolve/main/config.json''',
    # See all Perceiver models at https://huggingface.co/models?filter=perceiver
}

class    _UpperCAmelCase			(     snake_case_						):




   """simple docstring"""

   snake_case    				=						'''perceiver'''

   def __init__(		self :	Any      ,      __UpperCAmelCase :	Optional[Any]=256      ,      __UpperCAmelCase :	str=1280      ,      __UpperCAmelCase :	List[str]=768      ,      __UpperCAmelCase :	Union[str, Any]=1      ,      __UpperCAmelCase :	List[Any]=26      ,      __UpperCAmelCase :	int=8      ,      __UpperCAmelCase :	Union[str, Any]=8      ,      __UpperCAmelCase :	Dict=None      ,      __UpperCAmelCase :	Optional[Any]=None      ,      __UpperCAmelCase :	Optional[Any]="kv"      ,      __UpperCAmelCase :	int=1      ,      __UpperCAmelCase :	int=1      ,      __UpperCAmelCase :	str="gelu"      ,      __UpperCAmelCase :	List[Any]=0.1      ,      __UpperCAmelCase :	int=0.02      ,      __UpperCAmelCase :	Optional[Any]=1E-12      ,      __UpperCAmelCase :	str=True      ,      __UpperCAmelCase :	Dict=262      ,      __UpperCAmelCase :	List[str]=2048      ,      __UpperCAmelCase :	List[Any]=56      ,      __UpperCAmelCase :	Dict=[368, 496]      ,      __UpperCAmelCase :	Union[str, Any]=16      ,      __UpperCAmelCase :	Optional[Any]=1920      ,      __UpperCAmelCase :	Any=16      ,      __UpperCAmelCase :	Any=[1, 16, 224, 224]      ,      **__UpperCAmelCase :	Optional[int]      ,      ):





         '''simple docstring'''





         super().__init__(**__UpperCAmelCase		)

         _A			     =	num_latents
         _A			     =	d_latents
         _A			     =	d_model
         _A			     =	num_blocks
         _A			     =	num_self_attends_per_block
         _A			     =	num_self_attention_heads
         _A			     =	num_cross_attention_heads
         _A			     =	qk_channels
         _A			     =	v_channels
         _A			     =	cross_attention_shape_for_attention
         _A			     =	self_attention_widening_factor
         _A			     =	cross_attention_widening_factor
         _A			     =	hidden_act
         _A			     =	attention_probs_dropout_prob
         _A			     =	initializer_range
         _A			     =	layer_norm_eps
         _A			     =	use_query_residual
         # masked language modeling attributes
         _A			     =	vocab_size
         _A			     =	max_position_embeddings
         # image classification attributes
         _A			     =	image_size
         # flow attributes
         _A			     =	train_size
         # multimodal autoencoding attributes
         _A			     =	num_frames
         _A			     =	audio_samples_per_frame
         _A			     =	samples_per_patch
         _A			     =	output_shape





class    _UpperCAmelCase			(     snake_case_						):




   """simple docstring"""

   @property
   def 						lowerCAmelCase (		self :	Tuple		):





         '''simple docstring'''





         if self.task == "multiple-choice":
               _A			     =	{0: "batch", 1: "choice", 2: "sequence"}
         else:
               _A			     =	{0: "batch", 1: "sequence"}
         return OrderedDict(
             [
                 ("inputs", dynamic_axis),
                 ("attention_mask", dynamic_axis),
             ]		)

   @property
   def 						lowerCAmelCase (		self :	Union[str, Any]		):





         '''simple docstring'''





         return 1E-4

   def 						lowerCAmelCase (		self :	Dict      ,      __UpperCAmelCase :	Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]      ,      __UpperCAmelCase :	int = -1      ,      __UpperCAmelCase :	int = -1      ,      __UpperCAmelCase :	int = -1      ,      __UpperCAmelCase :	bool = False      ,      __UpperCAmelCase :	Optional[TensorType] = None      ,      __UpperCAmelCase :	int = 3      ,      __UpperCAmelCase :	int = 40      ,      __UpperCAmelCase :	int = 40      ,      ):





         '''simple docstring'''





         if isinstance(__UpperCAmelCase      ,      __UpperCAmelCase		):
               # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
               _A			     =	compute_effective_axis_dimension(
                   __UpperCAmelCase      ,      fixed_dimension=OnnxConfig.default_fixed_batch      ,      num_token_to_add=0		)
               # If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
               _A			     =	preprocessor.num_special_tokens_to_add(__UpperCAmelCase		)
               _A			     =	compute_effective_axis_dimension(
                   __UpperCAmelCase      ,      fixed_dimension=OnnxConfig.default_fixed_sequence      ,      num_token_to_add=__UpperCAmelCase		)
               # Generate dummy inputs according to compute batch and sequence
               _A			     =	[" ".join(["a"]		) * seq_length] * batch_size
               _A			     =	dict(preprocessor(__UpperCAmelCase      ,      return_tensors=__UpperCAmelCase		)		)
               _A			     =	inputs.pop("input_ids"		)
               return inputs
         elif isinstance(__UpperCAmelCase      ,      __UpperCAmelCase		) and preprocessor.model_input_names[0] == "pixel_values":
               # If dynamic axis (-1) we forward with a fixed dimension of 2 samples to avoid optimizations made by ONNX
               _A			     =	compute_effective_axis_dimension(__UpperCAmelCase      ,      fixed_dimension=OnnxConfig.default_fixed_batch		)
               _A			     =	self._generate_dummy_images(__UpperCAmelCase      ,      __UpperCAmelCase      ,      __UpperCAmelCase      ,      __UpperCAmelCase		)
               _A			     =	dict(preprocessor(images=__UpperCAmelCase      ,      return_tensors=__UpperCAmelCase		)		)
               _A			     =	inputs.pop("pixel_values"		)
               return inputs
         else:
               raise ValueError(
                   "Unable to generate dummy inputs for the model. Please provide a tokenizer or a preprocessor."		)












"""simple docstring"""
import qiskit



def      __lowerCamelCase   (							a_     :		int ,   a_     :		int							)			->      qiskit.result.counts.Counts:
      __SCREAMING_SNAKE_CASE   :Tuple						=  qiskit.Aer.get_backend('''aer_simulator'''							)

      # Create a Quantum Circuit acting on the q register
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  qiskit.QuantumCircuit(a_ ,   a_							)

      # 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   :Tuple						=  qiskit.execute(a_ ,   a_ ,   shots=10_00							)

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


if __name__ == "__main__":
  lowerCamelCase_								=		single_qubit_measure(2, 2)
  print(f'Total count for various states are: {counts}')