


"""simple docstring"""


from __future__ import annotations

import unittest

import numpy as np

from transformers import BlipTextConfig
from transformers.testing_utils import require_tf, slow
from transformers.utils import is_tf_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask


if is_tf_available():
	import tensorflow as tf

	from transformers import TFBlipTextModel
	from transformers.models.blip.modeling_tf_blip import TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST



class 			lowerCamelCase__						:







						def __init__(							self   :    Union[str, Any]			,			_lowercase   :    List[str]			,			_lowercase   :    Any=12			,			_lowercase   :    Union[str, Any]=7			,			_lowercase   :    str=True			,			_lowercase   :    Dict=True			,			_lowercase   :    Optional[int]=True			,			_lowercase   :    Any=99			,			_lowercase   :    List[str]=32			,			_lowercase   :    List[str]=32			,			_lowercase   :    int=2			,			_lowercase   :    List[str]=4			,			_lowercase   :    Optional[Any]=37			,			_lowercase   :    List[str]=0.1			,			_lowercase   :    Any=0.1			,			_lowercase   :    Optional[int]=512			,			_lowercase   :    Dict=0.0_2			,			_lowercase   :    List[Any]=0			,			_lowercase   :    Dict=None			,			):
								A					       = parent
								A					       = batch_size
								A					       = seq_length
								A					       = is_training
								A					       = use_input_mask
								A					       = use_labels
								A					       = vocab_size
								A					       = hidden_size
								A					       = projection_dim
								A					       = num_hidden_layers
								A					       = num_attention_heads
								A					       = intermediate_size
								A					       = dropout
								A					       = attention_dropout
								A					       = max_position_embeddings
								A					       = initializer_range
								A					       = scope
								A					       = bos_token_id







						def __a						(							self   :    Union[str, Any]		):
								A					       = ids_tensor([self.batch_size, self.seq_length]			,			self.vocab_size		)

								A					       = None
								if self.use_input_mask:
										A					       = random_attention_mask([self.batch_size, self.seq_length]		)

								if input_mask is not None:
										A					       = input_mask.numpy()
										A       , A					       = input_mask.shape
										A					       = np.random.randint(1			,			seq_length - 1			,			size=(batch_size,)		)
										for batch_idx, start_index in enumerate(_lowercase		):
												A					       = 1
												A					       = 0

								A					       = self.get_config()

								return config, input_ids, tf.convert_to_tensor(_lowercase		)







						def __a						(							self   :    str		):
								return BlipTextConfig(
								    vocab_size=self.vocab_size			,			hidden_size=self.hidden_size			,			projection_dim=self.projection_dim			,			num_hidden_layers=self.num_hidden_layers			,			num_attention_heads=self.num_attention_heads			,			intermediate_size=self.intermediate_size			,			dropout=self.dropout			,			attention_dropout=self.attention_dropout			,			max_position_embeddings=self.max_position_embeddings			,			initializer_range=self.initializer_range			,			bos_token_id=self.bos_token_id			,			)







						def __a						(							self   :    int			,			_lowercase   :    List[str]			,			_lowercase   :    List[Any]			,			_lowercase   :    Dict		):
								A					       = TFBlipTextModel(config=_lowercase		)
								A					       = model(_lowercase			,			attention_mask=_lowercase			,			training=_lowercase		)
								A					       = model(_lowercase			,			training=_lowercase		)
								self.parent.assertEqual(result.last_hidden_state.shape			,			(self.batch_size, self.seq_length, self.hidden_size)		)
								self.parent.assertEqual(result.pooler_output.shape			,			(self.batch_size, self.hidden_size)		)







						def __a						(							self   :    Union[str, Any]		):
								A					       = self.prepare_config_and_inputs()
								A       , A       , A					       = config_and_inputs
								A					       = {'input_ids': input_ids, 'attention_mask': input_mask}
								return config, inputs_dict



@require_tf
class 			lowerCamelCase__						(   UpperCAmelCase_							,    unittest.TestCase			):
						lowerCAmelCase       =     (TFBlipTextModel,) if is_tf_available() else ()
						lowerCAmelCase       =     False
						lowerCAmelCase       =     False
						lowerCAmelCase       =     False







						def __a						(							self   :    Any		):
								A					       = BlipTextModelTester(self		)
								A					       = ConfigTester(self			,			config_class=_lowercase			,			hidden_size=37		)







						def __a						(							self   :    Dict		):
								self.config_tester.run_common_tests()







						def __a						(							self   :    Dict		):
								A					       = self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*_lowercase		)







						def __a						(							self   :    Optional[Any]		):
								pass







						def __a						(							self   :    List[Any]		):
								pass







						@unittest.skip(reason='Blip does not use inputs_embeds'		)
						def __a						(							self   :    Dict		):
								pass







						@unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'		)
						def __a						(							self   :    List[str]		):
								pass







						@unittest.skip(reason='BlipTextModel has no base class and is not available in MODEL_MAPPING'		)
						def __a						(							self   :    Optional[int]		):
								pass







						@slow
						def __a						(							self   :    List[Any]		):
								for model_name in TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										A					       = TFBlipTextModel.from_pretrained(_lowercase		)
										self.assertIsNotNone(_lowercase		)







						def __a						(							self   :    List[str]			,			_lowercase   :    Tuple=True		):
								super().test_pt_tf_model_equivalence(allow_missing_keys=_lowercase		)









"""simple docstring"""


def  __snake_case       (   UpperCamelCase__ ,			UpperCamelCase__	)      ->		int:







		"""simple docstring"""





		while b:
				A       , A					       = b, a % b
		return a







def  __snake_case       (   UpperCamelCase__ ,			UpperCamelCase__	)      ->		int:







		"""simple docstring"""





		return a if b == 0 else euclidean_gcd_recursive(UpperCamelCase__ ,			a % b	)







def  __snake_case       (   )      ->		List[Any]:







		"""simple docstring"""





		print(f'euclidean_gcd(3, 5) = {euclidean_gcd(3 ,			5	)}'	)
		print(f'euclidean_gcd(5, 3) = {euclidean_gcd(5 ,			3	)}'	)
		print(f'euclidean_gcd(1, 3) = {euclidean_gcd(1 ,			3	)}'	)
		print(f'euclidean_gcd(3, 6) = {euclidean_gcd(3 ,			6	)}'	)
		print(f'euclidean_gcd(6, 3) = {euclidean_gcd(6 ,			3	)}'	)

		print(f'euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3 ,			5	)}'	)
		print(f'euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5 ,			3	)}'	)
		print(f'euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1 ,			3	)}'	)
		print(f'euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3 ,			6	)}'	)
		print(f'euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6 ,			3	)}'	)


if __name__ == "__main__":
	main()





