'''simple docstring'''




import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging


snake_case  =			logging.get_logger(__name__)

snake_case  =			{
    '''facebook/sam-vit-huge''': '''https://huggingface.co/facebook/sam-vit-huge/resolve/main/config.json''',
    '''facebook/sam-vit-large''': '''https://huggingface.co/facebook/sam-vit-large/resolve/main/config.json''',
    '''facebook/sam-vit-base''': '''https://huggingface.co/facebook/sam-vit-base/resolve/main/config.json''',
}





class        SCREAMING_SNAKE_CASE   (				__a ):
  """simple docstring"""







  def __init__(  self   :					Dict					,					__lowerCAmelCase   :					Optional[Any]=256					,					__lowerCAmelCase   :					List[str]=1024					,					__lowerCAmelCase   :					Any=16					,					__lowerCAmelCase   :					int=16					,					__lowerCAmelCase   :					Tuple=4					,					__lowerCAmelCase   :					Optional[Any]="gelu"					,					__lowerCAmelCase   :					Union[str, Any]=1e-6					,					**__lowerCAmelCase   :					Dict					,					):


        """simple docstring"""



        super().__init__(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   hidden_size
        _lowerCAmelCase		   =   image_size
        _lowerCAmelCase		   =   patch_size
        _lowerCAmelCase		   =   image_size // patch_size
        _lowerCAmelCase		   =   mask_input_channels
        _lowerCAmelCase		   =   num_point_embeddings
        _lowerCAmelCase		   =   hidden_act
        _lowerCAmelCase		   =   layer_norm_eps





class        SCREAMING_SNAKE_CASE   (				__a ):
  """simple docstring"""







  def __init__(  self   :					List[Any]					,					__lowerCAmelCase   :					List[str]=256					,					__lowerCAmelCase   :					Any="relu"					,					__lowerCAmelCase   :					str=2048					,					__lowerCAmelCase   :					List[str]=2					,					__lowerCAmelCase   :					Any=8					,					__lowerCAmelCase   :					Optional[int]=2					,					__lowerCAmelCase   :					str=3					,					__lowerCAmelCase   :					Any=3					,					__lowerCAmelCase   :					Tuple=256					,					__lowerCAmelCase   :					Optional[int]=1e-6					,					**__lowerCAmelCase   :					Dict					,					):


        """simple docstring"""



        super().__init__(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   hidden_size
        _lowerCAmelCase		   =   hidden_act
        _lowerCAmelCase		   =   mlp_dim
        _lowerCAmelCase		   =   num_hidden_layers
        _lowerCAmelCase		   =   num_attention_heads
        _lowerCAmelCase		   =   attention_downsample_rate
        _lowerCAmelCase		   =   num_multimask_outputs
        _lowerCAmelCase		   =   iou_head_depth
        _lowerCAmelCase		   =   iou_head_hidden_dim
        _lowerCAmelCase		   =   layer_norm_eps





class        SCREAMING_SNAKE_CASE   (				__a ):
  """simple docstring"""







  def __init__(  self   :					Any					,					__lowerCAmelCase   :					Optional[int]=768					,					__lowerCAmelCase   :					Optional[Any]=256					,					__lowerCAmelCase   :					List[str]=12					,					__lowerCAmelCase   :					Dict=12					,					__lowerCAmelCase   :					List[str]=3					,					__lowerCAmelCase   :					str=1024					,					__lowerCAmelCase   :					Optional[Any]=16					,					__lowerCAmelCase   :					Optional[int]="gelu"					,					__lowerCAmelCase   :					Any=1e-06					,					__lowerCAmelCase   :					List[Any]=0.0					,					__lowerCAmelCase   :					str=1e-10					,					__lowerCAmelCase   :					Tuple=True					,					__lowerCAmelCase   :					Tuple=4.0					,					__lowerCAmelCase   :					Tuple=True					,					__lowerCAmelCase   :					str=True					,					__lowerCAmelCase   :					int=14					,					__lowerCAmelCase   :					Optional[int]=[2, 5, 8, 11]					,					__lowerCAmelCase   :					Dict=128					,					__lowerCAmelCase   :					int=None					,					**__lowerCAmelCase   :					Tuple					,					):


        """simple docstring"""



        super().__init__(**__lowerCAmelCase					)

        _lowerCAmelCase		   =   hidden_size
        _lowerCAmelCase		   =   output_channels
        _lowerCAmelCase		   =   num_hidden_layers
        _lowerCAmelCase		   =   num_attention_heads
        _lowerCAmelCase		   =   num_channels
        _lowerCAmelCase		   =   image_size
        _lowerCAmelCase		   =   patch_size
        _lowerCAmelCase		   =   hidden_act
        _lowerCAmelCase		   =   layer_norm_eps
        _lowerCAmelCase		   =   attention_dropout
        _lowerCAmelCase		   =   initializer_range
        _lowerCAmelCase		   =   qkv_bias
        _lowerCAmelCase		   =   mlp_ratio
        _lowerCAmelCase		   =   use_abs_pos
        _lowerCAmelCase		   =   use_rel_pos
        _lowerCAmelCase		   =   window_size
        _lowerCAmelCase		   =   global_attn_indexes
        _lowerCAmelCase		   =   num_pos_feats
        _lowerCAmelCase		   =   int(hidden_size * mlp_ratio					) if mlp_dim is None else mlp_dim





class        SCREAMING_SNAKE_CASE   (				__a ):
  """simple docstring"""







  __A     =		"sam"
  __A     =		True



  def __init__(  self   :					Any					,					__lowerCAmelCase   :					Union[str, Any]=None					,					__lowerCAmelCase   :					str=None					,					__lowerCAmelCase   :					List[str]=None					,					__lowerCAmelCase   :					str=0.0_2					,					**__lowerCAmelCase   :					Any					,					):


        """simple docstring"""



        super().__init__(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   vision_config if vision_config is not None else {}
        _lowerCAmelCase		   =   prompt_encoder_config if prompt_encoder_config is not None else {}
        _lowerCAmelCase		   =   mask_decoder_config if mask_decoder_config is not None else {}

        if isinstance(__lowerCAmelCase					,					__lowerCAmelCase					):
              _lowerCAmelCase		   =   vision_config.to_dict()
        if isinstance(__lowerCAmelCase					,					__lowerCAmelCase					):
              _lowerCAmelCase		   =   prompt_encoder_config.to_dict()
        if isinstance(__lowerCAmelCase					,					__lowerCAmelCase					):
              _lowerCAmelCase		   =   mask_decoder_config.to_dict()

        _lowerCAmelCase		   =   SamVisionConfig(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   SamPromptEncoderConfig(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   SamMaskDecoderConfig(**__lowerCAmelCase					)
        _lowerCAmelCase		   =   initializer_range



  def   a   (  self   :					List[str]					):


        """simple docstring"""



        _lowerCAmelCase		   =   copy.deepcopy(self.__dict__					)
        _lowerCAmelCase		   =   self.vision_config.to_dict()
        _lowerCAmelCase		   =   self.prompt_encoder_config.to_dict()
        _lowerCAmelCase		   =   self.mask_decoder_config.to_dict()
        _lowerCAmelCase		   =   self.__class__.model_type
        return output






'''simple docstring'''




import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute







def 			A_   ( _lowerCamelCase			:							float = np.pi / 2  ,  _lowerCamelCase			:							float = np.pi / 2  ,  _lowerCamelCase			:							float = np.pi / 2    ):
      _lowerCAmelCase		   =   QuantumRegister(3  ,  'qr'    )  # Define the number of quantum bits
      _lowerCAmelCase		   =   ClassicalRegister(1  ,  'cr'    )  # Define the number of classical bits

      _lowerCAmelCase		   =   QuantumCircuit(_lowerCamelCase  ,  _lowerCamelCase    )  # Define the quantum circuit.

      # Build the circuit
      quantum_circuit.u(_lowerCamelCase  ,  _lowerCamelCase  ,  _lowerCamelCase  ,  0    )  # Quantum State to teleport
      quantum_circuit.h(1    )  # add hadamard gate
      quantum_circuit.cx(
          1  ,  2    )  # add control gate with qubit 1 as control and 2 as target.
      quantum_circuit.cx(0  ,  1    )
      quantum_circuit.h(0    )
      quantum_circuit.cz(0  ,  2    )  # add control z gate.
      quantum_circuit.cx(1  ,  2    )

      quantum_circuit.measure([2]  ,  [0]    )  # measure the qubit.

      # Simulate the circuit using qasm simulator
      _lowerCAmelCase		   =   Aer.get_backend('aer_simulator'    )
      _lowerCAmelCase		   =   execute(_lowerCamelCase  ,  _lowerCamelCase  ,  shots=1_000    )

      return job.result().get_counts(_lowerCamelCase    )


if __name__ == "__main__":
 print(
     '''Total count for teleported state is: '''
     f'''{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}'''
 )





