





'''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 		lowerCamelCase	(   unittest.TestCase							):



	@slow
	def 	_lowerCamelCase     ( self						):
			lowerCAmelCase  :     Tuple       						= AutoImageProcessor.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"						)
			lowerCAmelCase  :     Tuple       						= AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"						)
			model.to(a_						)

			from datasets import load_dataset

			lowerCAmelCase  :     Any       						= load_dataset("nielsr/rvlcdip-demo"						)

			lowerCAmelCase  :     List[Any]       						= dataset["train"][0]["image"].convert("RGB"						)

			lowerCAmelCase  :     Optional[int]       						= image_processor(a_		,   return_tensors="pt"						).to(a_						)

			# forward pass
			with torch.no_grad():
					lowerCAmelCase  :     int       						= model(**a_						)
					lowerCAmelCase  :     Dict       						= outputs.logits

			lowerCAmelCase  :     Tuple       						= torch.Size((1, 16)						)
			self.assertEqual(logits.shape		,   a_						)

			lowerCAmelCase  :     Dict       						= torch.tensor(
			    [-0.4158, -0.4092, -0.4347]		,   device=a_		,   dtype=torch.float		,   )
			self.assertTrue(torch.allclose(logits[0, :3]		,   a_		,   atol=1e-4						)						)










'''simple docstring'''






import random
from typing import Any






def   __A    (				a_    :	list						):
		for _ in range(len(a_						)						):
				lowerCAmelCase  :     List[Any]       						= random.randint(0   ,len(a_						) - 1						)
				lowerCAmelCase  :     Tuple       						= random.randint(0   ,len(a_						) - 1						)
				lowerCAmelCase						,		lowerCAmelCase  :     Optional[Any]       						= data[b], data[a]
		return data


if __name__ == "__main__":
					lowerCAmelCase									=   [0, 1, 2, 3, 4, 5, 6, 7]
					lowerCAmelCase									=   ["""python""", """says""", """hello""", """!"""]
					print("""Fisher-Yates Shuffle:""")
					print("""List""", integers, strings)
					print("""FY Shuffle""", fisher_yates_shuffle(integers), fisher_yates_shuffle(strings))



