



'''simple docstring'''





import copy

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


A			:   Tuple			=      logging.get_logger(__name__)

A			:   List[str]			=      {
    """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 							lowerCAmelCase_		(	a_						):





    def __init__(    self    :    str,    _snake_case    :    List[Any]=256,    _snake_case    :    Tuple=1_024,    _snake_case    :    int=16,    _snake_case    :    int=16,    _snake_case    :    Union[str, Any]=4,    _snake_case    :    Optional[Any]="gelu",    _snake_case    :    int=1E-6,    **_snake_case    :    List[str],    ):



       '''simple docstring'''







       super().__init__(**_snake_case     )
       snake_case   :							str						  =hidden_size
       snake_case   :							List[str]						  =image_size
       snake_case   :							Optional[Any]						  =patch_size
       snake_case   :							List[Any]						  =image_size // patch_size
       snake_case   :							str						  =mask_input_channels
       snake_case   :							Any						  =num_point_embeddings
       snake_case   :							Union[str, Any]						  =hidden_act
       snake_case   :							Any						  =layer_norm_eps





class 							lowerCAmelCase_		(	a_						):





    def __init__(    self    :    List[Any],    _snake_case    :    Optional[Any]=256,    _snake_case    :    Optional[Any]="relu",    _snake_case    :    Optional[int]=2_048,    _snake_case    :    Union[str, Any]=2,    _snake_case    :    str=8,    _snake_case    :    int=2,    _snake_case    :    Dict=3,    _snake_case    :    Optional[int]=3,    _snake_case    :    List[Any]=256,    _snake_case    :    List[Any]=1E-6,    **_snake_case    :    List[Any],    ):



       '''simple docstring'''







       super().__init__(**_snake_case     )
       snake_case   :							Any						  =hidden_size
       snake_case   :							List[Any]						  =hidden_act
       snake_case   :							Tuple						  =mlp_dim
       snake_case   :							List[Any]						  =num_hidden_layers
       snake_case   :							Any						  =num_attention_heads
       snake_case   :							Optional[int]						  =attention_downsample_rate
       snake_case   :							List[Any]						  =num_multimask_outputs
       snake_case   :							Union[str, Any]						  =iou_head_depth
       snake_case   :							List[str]						  =iou_head_hidden_dim
       snake_case   :							Dict						  =layer_norm_eps





class 							lowerCAmelCase_		(	a_						):





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



       '''simple docstring'''







       super().__init__(**_snake_case     )

       snake_case   :							Union[str, Any]						  =hidden_size
       snake_case   :							int						  =output_channels
       snake_case   :							Optional[int]						  =num_hidden_layers
       snake_case   :							Dict						  =num_attention_heads
       snake_case   :							Any						  =num_channels
       snake_case   :							str						  =image_size
       snake_case   :							Optional[Any]						  =patch_size
       snake_case   :							Union[str, Any]						  =hidden_act
       snake_case   :							Union[str, Any]						  =layer_norm_eps
       snake_case   :							Union[str, Any]						  =attention_dropout
       snake_case   :							Optional[int]						  =initializer_range
       snake_case   :							Tuple						  =qkv_bias
       snake_case   :							Optional[int]						  =mlp_ratio
       snake_case   :							Dict						  =use_abs_pos
       snake_case   :							Dict						  =use_rel_pos
       snake_case   :							List[str]						  =window_size
       snake_case   :							List[Any]						  =global_attn_indexes
       snake_case   :							Optional[int]						  =num_pos_feats
       snake_case   :							Dict						  =int(hidden_size * mlp_ratio     ) if mlp_dim is None else mlp_dim





class 							lowerCAmelCase_		(	a_						):
    __UpperCAmelCase							=	'sam'
    __UpperCAmelCase							=	True





    def __init__(    self    :    Optional[int],    _snake_case    :    Any=None,    _snake_case    :    Optional[int]=None,    _snake_case    :    Union[str, Any]=None,    _snake_case    :    List[Any]=0.02,    **_snake_case    :    Union[str, Any],    ):



       '''simple docstring'''







       super().__init__(**_snake_case     )
       snake_case   :							List[str]						  =vision_config if vision_config is not None else {}
       snake_case   :							List[Any]						  =prompt_encoder_config if prompt_encoder_config is not None else {}
       snake_case   :							Dict						  =mask_decoder_config if mask_decoder_config is not None else {}

       if isinstance(_snake_case,    _snake_case     ):
          snake_case   :							Any						  =vision_config.to_dict()
       if isinstance(_snake_case,    _snake_case     ):
          snake_case   :							Dict						  =prompt_encoder_config.to_dict()
       if isinstance(_snake_case,    _snake_case     ):
          snake_case   :							Any						  =mask_decoder_config.to_dict()

       snake_case   :							List[str]						  =SamVisionConfig(**_snake_case     )
       snake_case   :							List[str]						  =SamPromptEncoderConfig(**_snake_case     )
       snake_case   :							Any						  =SamMaskDecoderConfig(**_snake_case     )
       snake_case   :							Union[str, Any]						  =initializer_range






    def 					__snake_case       (    self    :    Optional[int]     ):



       '''simple docstring'''







       snake_case   :							Optional[int]						  =copy.deepcopy(self.__dict__     )
       snake_case   :							Optional[Any]						  =self.vision_config.to_dict()
       snake_case   :							List[str]						  =self.prompt_encoder_config.to_dict()
       snake_case   :							Tuple						  =self.mask_decoder_config.to_dict()
       snake_case   :							Dict						  =self.__class__.model_type
       return output










'''simple docstring'''





import doctest

import projectq
from projectq.ops import H, Measure
def 		_a   (  lowerCamelCase_							):
   snake_case   :							str						  =quantum_engine.allocate_qubit()
   H | qubit
   Measure | qubit
   return int(lowerCamelCase_							)


if __name__ == "__main__":
      doctest.testmod()

      # initialises a new quantum backend
      A			:   Dict			=      projectq.MainEngine()

      # Generate a list of 10 random numbers
      A			:   Dict			=      [get_random_number(quantum_engine) for _ in range(10)]

      # Flushes the quantum engine from memory
      quantum_engine.flush()

      print("""Random numbers""", random_numbers_list)





