





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


     @slow
     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






          __A						:			str								=	AutoImageProcessor.from_pretrained('microsoft/dit-base-finetuned-rvlcdip')
          __A						:			Tuple								=	AutoModelForImageClassification.from_pretrained('microsoft/dit-base-finetuned-rvlcdip')
          model.to(_UpperCAmelCase)

          from datasets import load_dataset

          __A						:			Tuple								=	load_dataset('nielsr/rvlcdip-demo')

          __A						:			Any								=	dataset['train'][0]['image'].convert('RGB')

          __A						:			Tuple								=	image_processor(_UpperCAmelCase						,     return_tensors='pt').to(_UpperCAmelCase)

          # forward pass
          with torch.no_grad():
               __A						:			Union[str, Any]								=	model(**_UpperCAmelCase)
               __A						:			Tuple								=	outputs.logits

          __A						:			Optional[int]								=	torch.Size((1, 16))
          self.assertEqual(logits.shape						,     _UpperCAmelCase)

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






'''simple docstring'''




import itertools
import math






def 	_lowerCAmelCase      (  __snake_case  :			int      )					->					bool:

     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or number % 2 == 0 or number % 3 == 0:
          # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
          return False

     # All primes number are in format of 6k +/- 1
     for i in range(5			,							int(math.sqrt(__snake_case      ) + 1      )			,							6      ):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True






def 	_lowerCAmelCase      (  )					->					List[Any]:
     __A						:			Optional[Any]								=	2
     while True:
          if is_prime(__snake_case      ):
               yield num
          num += 1






def 	_lowerCAmelCase      (  __snake_case  :			int = 1_00_01      )					->					int:
     return next(itertools.islice(prime_generator()			,							nth - 1			,							__snake_case      )      )


if __name__ == "__main__":
  print(f"""{solution() = }""")