


"""simple docstring"""
import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin




class 	lowercase__				(					A_ ,A_				):





   @register_to_config
   def __init__(							self      ,   *,
       SCREAMING_SNAKE_CASE = 4      ,   SCREAMING_SNAKE_CASE = 768      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   )  ->  Any:
      super().__init__()

      _lowerCamelCase	:					int   =		nn.Parameter(torch.zeros(SCREAMING_SNAKE_CASE))

      # parameters for additional clip time embeddings
      _lowerCamelCase	:					Union[str, Any]   =		nn.Linear(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Optional[int]   =		nn.Linear(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)

      # parameters for encoder hidden states
      _lowerCamelCase	:					Optional[Any]   =		clip_extra_context_tokens
      _lowerCamelCase	:					int   =		nn.Linear(
          SCREAMING_SNAKE_CASE      ,   self.clip_extra_context_tokens * cross_attention_dim)
      _lowerCamelCase	:					Tuple   =		nn.Linear(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					int   =		nn.LayerNorm(SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self      ,   *, SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE)  ->  Optional[int]:
      if do_classifier_free_guidance:
         # Add the classifier free guidance embeddings to the image embeddings
         _lowerCamelCase	:					List[Any]   =		image_embeddings.shape[0]
         _lowerCamelCase	:					str   =		self.learned_classifier_free_guidance_embeddings.unsqueeze(0)
         _lowerCamelCase	:					Optional[Any]   =		classifier_free_guidance_embeddings.expand(
             SCREAMING_SNAKE_CASE      ,   -1)
         _lowerCamelCase	:					Optional[int]   =		torch.cat([classifier_free_guidance_embeddings, image_embeddings]      ,   dim=0)

      # The image embeddings batch size and the text embeddings batch size are equal
      assert image_embeddings.shape[0] == prompt_embeds.shape[0]

      _lowerCamelCase	:					List[Any]   =		prompt_embeds.shape[0]

      # "Specifically, we modify the architecture described in Nichol et al. (2021) by projecting and
      # adding CLIP embeddings to the existing timestep embedding, ...
      _lowerCamelCase	:					Tuple   =		self.embedding_proj(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Dict   =		self.clip_image_embeddings_project_to_time_embeddings(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Union[str, Any]   =		time_projected_image_embeddings + time_projected_prompt_embeds

      # ... and by projecting CLIP embeddings into four
      # extra tokens of context that are concatenated to the sequence of outputs from the GLIDE text encoder"
      _lowerCamelCase	:					int   =		self.clip_extra_context_tokens_proj(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					int   =		clip_extra_context_tokens.reshape(SCREAMING_SNAKE_CASE      ,   -1      ,   self.clip_extra_context_tokens)
      _lowerCamelCase	:					int   =		clip_extra_context_tokens.permute(0      ,   2      ,   1)

      _lowerCamelCase	:					List[Any]   =		self.encoder_hidden_states_proj(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Dict   =		self.text_encoder_hidden_states_norm(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Dict   =		torch.cat([clip_extra_context_tokens, text_encoder_hidden_states]      ,   dim=1)

      return text_encoder_hidden_states, additive_clip_time_embeddings









"""simple docstring"""


import qiskit


def        UpperCAmelCase      (					a__     ,      a__ ):





						'''simple docstring'''






						lowerCAmelCase   :List[Any]						=			qiskit.Aer.get_backend('aer_simulator' )

						# Create a Quantum Circuit acting on the q register
						lowerCAmelCase   :Optional[int]						=			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
						lowerCAmelCase   :Dict						=			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__":
		__SCREAMING_SNAKE_CASE   =   single_qubit_measure(2, 2)
		print(F"""Total count for various states are: {counts}""")