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



  """simple docstring"""







  @slow
  def    lowercase_  (							self					):

    '''simple docstring'''







    __UpperCAmelCase:					Any		= AutoImageProcessor.from_pretrained("""microsoft/dit-base-finetuned-rvlcdip"""					)
    __UpperCAmelCase:					str		= AutoModelForImageClassification.from_pretrained("""microsoft/dit-base-finetuned-rvlcdip"""					)
    model.to(_UpperCAmelCase					)

    from datasets import load_dataset

    __UpperCAmelCase:					int		= load_dataset("""nielsr/rvlcdip-demo"""					)

    __UpperCAmelCase:					str		= dataset['''train'''][0]['''image'''].convert("""RGB"""					)

    __UpperCAmelCase:					Optional[int]		= image_processor(_UpperCAmelCase   ,    return_tensors="""pt"""					).to(_UpperCAmelCase					)

    # forward pass
    with torch.no_grad():
      __UpperCAmelCase:					Optional[Any]		= model(**_UpperCAmelCase					)
      __UpperCAmelCase:					List[str]		= outputs.logits

    __UpperCAmelCase:					Any		= torch.Size((1, 16)					)
    self.assertEqual(logits.shape   ,    _UpperCAmelCase					)

    __UpperCAmelCase:					str		= torch.tensor(
        [-0.4_1_5_8, -0.4_0_9_2, -0.4_3_4_7]   ,    device=_UpperCAmelCase   ,    dtype=torch.float   ,    )
    self.assertTrue(torch.allclose(logits[0, :3]   ,    _UpperCAmelCase   ,    atol=1e-4					)					)
'''simple docstring'''






import itertools
import math






def  UpperCamelCase__					(					_lowercase    :				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(_lowercase     ) + 1     )   ,    6     ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True






def  UpperCamelCase__					(					)							->	Optional[int]:
  __UpperCAmelCase:					Union[str, Any]		= 2
  while True:
    if is_prime(_lowercase     ):
      yield num
    num += 1






def  UpperCamelCase__					(					_lowercase    :				int = 1_0_0_0_1     )							->	int:
  return next(itertools.islice(prime_generator()   ,    nth - 1   ,    _lowercase     )     )


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