






'''simple docstring'''


import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
					import torch

					from transformers import CamembertModel
@require_torch
@require_sentencepiece
@require_tokenizers
class  _SCREAMING_SNAKE_CASE				(		unittest.TestCase						):


			'''simple docstring'''





			@slow
			def 					A   ( self				:    Optional[Any]      )				->     Tuple:

									'''simple docstring'''







									UpperCamelCase__       =			CamembertModel.from_pretrained("""camembert-base"""      )
									model.to(lowercase      )

									UpperCamelCase__       =			torch.tensor(
									    [[5, 1_2_1, 1_1, 6_6_0, 1_6, 7_3_0, 2_5_5_4_3, 1_1_0, 8_3, 6]]			,   device=lowercase			,   dtype=torch.long			,   )  # J'aime le camembert !
									with torch.no_grad():
															UpperCamelCase__       =			model(lowercase      )["""last_hidden_state"""]
									UpperCamelCase__       =			torch.Size((1, 1_0, 7_6_8)      )
									self.assertEqual(output.shape			,   lowercase      )
									# compare the actual values for a slice.
									UpperCamelCase__       =			torch.tensor(
									    [[[-0.0_2_5_4, 0.0_2_3_5, 0.1_0_2_7], [0.0_6_0_6, -0.1_8_1_1, -0.0_4_1_8], [-0.1_5_6_1, -0.1_1_2_7, 0.2_6_8_7]]]			,   device=lowercase			,   dtype=torch.float			,   )
									# camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
									# camembert.eval()
									# expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

									self.assertTrue(torch.allclose(output[:, :3, :3]			,   lowercase			,   atol=1e-4      )      )








'''simple docstring'''


def 						__magic_name__(			_A       ):
						'''simple docstring'''





						UpperCamelCase__       =			len(_A       )

						# Set the gap value to be decreased by a factor of 1.3
						# after each iteration
						UpperCamelCase__       =			1.3

						# Continue sorting until the gap is 1
						while gap > 1:
												# Decrease the gap value
												UpperCamelCase__       =			int(gap / shrink       )

												# Sort the elements using insertion sort
												for i in range(_A    ,   len(_A       )       ):
																		UpperCamelCase__       =			collection[i]
																		UpperCamelCase__       =			i
																		while j >= gap and collection[j - gap] > temp:
																								UpperCamelCase__       =			collection[j - gap]
																								j -= gap
																		UpperCamelCase__       =			temp

						return collection


if __name__ == "__main__":
					import doctest

					doctest.testmod()
