"""simple docstring"""






import unittest

from transformers import is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_vision, slow, torch_device


if is_torch_available():
						import torch

						from transformers import AutoModelForImageClassification

if is_vision_available():
						from transformers import AutoImageProcessor
@require_torch
@require_vision
class 				snake_case       ( unittest.TestCase				):




					"""simple docstring"""

					@slow
					def 		__lowerCAmelCase						(				self   :	List[str]			):
									UpperCAmelCase__             =							AutoImageProcessor.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'			)
									UpperCAmelCase__             =							AutoModelForImageClassification.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'			)
									model.to(__snake_case			)

									from datasets import load_dataset

									UpperCAmelCase__             =							load_dataset('nielsr/rvlcdip-demo'			)

									UpperCAmelCase__             =							dataset["""train"""][0]["""image"""].convert('RGB'			)

									UpperCAmelCase__             =							image_processor(__snake_case    ,return_tensors='pt'			).to(__snake_case			)

									# forward pass
									with torch.no_grad():
													UpperCAmelCase__             =							model(**__snake_case			)
													UpperCAmelCase__             =							outputs.logits

									UpperCAmelCase__             =							torch.Size((1, 16)			)
									self.assertEqual(logits.shape    ,__snake_case			)

									UpperCAmelCase__             =							torch.tensor(
									    [-0.4_1_5_8, -0.4_0_9_2, -0.4_3_4_7]    ,device=__snake_case    ,dtype=torch.float    ,)
									self.assertTrue(torch.allclose(logits[0, :3]    ,__snake_case    ,atol=1e-4			)			)







'''simple docstring'''


def 			snake_case_   (  SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       str     		=      0
				for ch in input_str:
								_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      ord(SCREAMING_SNAKE_CASE__     )
								_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      pow(2							,      SCREAMING_SNAKE_CASE__     )

								# If we already turned on bit for current character's unicode
								if bitmap >> ch_unicode & 1 == 1:
												return False
								bitmap |= ch_bit_index_on
				return True


if __name__ == "__main__":
				import doctest

				doctest.testmod()




