






from ...configuration_utils import PretrainedConfig
from ...utils import is_detectrona_available, logging


lowercase  							= logging.get_logger(__name__)

lowercase  							= {
    "layoutlmv2-base-uncased": "https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/config.json",
    "layoutlmv2-large-uncased": "https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/config.json",
    # See all LayoutLMv2 models at https://huggingface.co/models?filter=layoutlmv2
}

# soft dependency
if is_detectrona_available():
	import detectrona




class 			UpperCamelCase_				(      snake_case_    ):



	'''simple docstring'''




	lowerCAmelCase													=			'''layoutlmv2'''




	def __init__(	self	,      a=3_05_22	,      a=7_68	,      a=12	,      a=12	,      a=30_72	,      a="gelu"	,      a=0.1	,      a=0.1	,      a=5_12	,      a=2	,      a=0.02	,      a=1E-12	,      a=0	,      a=10_24	,      a=1_28	,      a=32	,      a=True	,      a=2_56	,      a=64	,      a=True	,      a=[7, 7, 2_56]	,      a=1_28	,      a=1_28	,      a=True	,      a=True	,      a=False	,      a=None	,      **a	,      )	->   List[Any]:
								super().__init__(
								    vocab_size=a	,      hidden_size=a	,      num_hidden_layers=a	,      num_attention_heads=a	,      intermediate_size=a	,      hidden_act=a	,      hidden_dropout_prob=a	,      attention_probs_dropout_prob=a	,      max_position_embeddings=a	,      type_vocab_size=a	,      initializer_range=a	,      layer_norm_eps=a	,      pad_token_id=a	,      **a	,      )
								snake_case_           =							max_ad_position_embeddings
								snake_case_           =							max_rel_pos
								snake_case_           =							rel_pos_bins
								snake_case_           =							fast_qkv
								snake_case_           =							max_rel_ad_pos
								snake_case_           =							rel_ad_pos_bins
								snake_case_           =							convert_sync_batchnorm
								snake_case_           =							image_feature_pool_shape
								snake_case_           =							coordinate_size
								snake_case_           =							shape_size
								snake_case_           =							has_relative_attention_bias
								snake_case_           =							has_spatial_attention_bias
								snake_case_           =							has_visual_segment_embedding
								snake_case_           =							(
								    detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
								)




	@classmethod
	def 							_UpperCamelCase      (	self )	->   Optional[int]:
								return {
								    "MODEL.MASK_ON": True,
								    "MODEL.PIXEL_STD": [57.375, 57.120, 58.395],
								    "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone",
								    "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"],
								    "MODEL.ANCHOR_GENERATOR.SIZES": [[32], [64], [1_28], [2_56], [5_12]],
								    "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
								    "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 20_00,
								    "MODEL.RPN.PRE_NMS_TOPK_TEST": 10_00,
								    "MODEL.RPN.POST_NMS_TOPK_TRAIN": 10_00,
								    "MODEL.POST_NMS_TOPK_TEST": 10_00,
								    "MODEL.ROI_HEADS.NAME": "StandardROIHeads",
								    "MODEL.ROI_HEADS.NUM_CLASSES": 5,
								    "MODEL.ROI_HEADS.IN_FEATURES": ["p2", "p3", "p4", "p5"],
								    "MODEL.ROI_BOX_HEAD.NAME": "FastRCNNConvFCHead",
								    "MODEL.ROI_BOX_HEAD.NUM_FC": 2,
								    "MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION": 14,
								    "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead",
								    "MODEL.ROI_MASK_HEAD.NUM_CONV": 4,
								    "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7,
								    "MODEL.RESNETS.DEPTH": 1_01,
								    "MODEL.RESNETS.SIZES": [[32], [64], [1_28], [2_56], [5_12]],
								    "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]],
								    "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"],
								    "MODEL.RESNETS.NUM_GROUPS": 32,
								    "MODEL.RESNETS.WIDTH_PER_GROUP": 8,
								    "MODEL.RESNETS.STRIDE_IN_1X1": False,
								}






	def 							_UpperCamelCase      (	self )	->   List[str]:
								snake_case_           =							detectrona.config.get_cfg()
								for k, v in self.detectrona_config_args.items():
															snake_case_           =							k.split('.' )
															snake_case_           =							detectrona_config
															for attribute in attributes[:-1]:
																						snake_case_           =							getattr(a	,      a )
															setattr(a	,      attributes[-1]	,      a )

								return detectrona_config













from __future__ import annotations





def 						__UpperCAmelCase      (					a_):
							for r in range(1							,					a_):
														snake_case_           =							[]
														for x in range(n - 1):
																					snake_case_           =							pow(a_							,					a_							,					a_)
																					if val in li:
																												break
																					li.append(a_)
														else:
																					return r
							return None


if __name__ == "__main__":
	lowercase  							= int(input("Enter a prime number q: "))
	lowercase  							= find_primitive(q)
	if a is None:
		print(f'Cannot find the primitive for the value: {a!r}')
	else:
		lowercase  							= int(input("Enter private key of A: "))
		lowercase  							= pow(a, a_private, q)
		lowercase  							= int(input("Enter private key of B: "))
		lowercase  							= pow(a, b_private, q)

		lowercase  							= pow(b_public, a_private, q)
		lowercase  							= pow(a_public, b_private, q)

		print("The key value generated by A is: ", a_secret)
		print("The key value generated by B is: ", b_secret)





