






import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
					import torch

if is_vision_available():
					from PIL import Image

					from transformers import ConvNextImageProcessor


class 			__SCREAMING_SNAKE_CASE    (      unittest.TestCase):






						def __init__(		self   ,  _UpperCamelCase   ,  _UpperCamelCase=7   ,  _UpperCamelCase=3   ,  _UpperCamelCase=18   ,  _UpperCamelCase=30   ,  _UpperCamelCase=4_00   ,  _UpperCamelCase=True   ,  _UpperCamelCase=None   ,  _UpperCamelCase=0.8_75   ,  _UpperCamelCase=True   ,  _UpperCamelCase=[0.5, 0.5, 0.5]   ,  _UpperCamelCase=[0.5, 0.5, 0.5]   ,  ):






												"""simple docstring"""
												lowerCAmelCase__			  =  size if size is not None else {'shortest_edge': 20}
												lowerCAmelCase__			  =  parent
												lowerCAmelCase__			  =  batch_size
												lowerCAmelCase__			  =  num_channels
												lowerCAmelCase__			  =  image_size
												lowerCAmelCase__			  =  min_resolution
												lowerCAmelCase__			  =  max_resolution
												lowerCAmelCase__			  =  do_resize
												lowerCAmelCase__			  =  size
												lowerCAmelCase__			  =  crop_pct
												lowerCAmelCase__			  =  do_normalize
												lowerCAmelCase__			  =  image_mean
												lowerCAmelCase__			  =  image_std







						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												return {
												    "image_mean": self.image_mean,
												    "image_std": self.image_std,
												    "do_normalize": self.do_normalize,
												    "do_resize": self.do_resize,
												    "size": self.size,
												    "crop_pct": self.crop_pct,
												}




@require_torch
@require_vision
class 			__SCREAMING_SNAKE_CASE    (      _UpperCamelCase						,    unittest.TestCase):
						_SCREAMING_SNAKE_CASE		:				List[str]            =    ConvNextImageProcessor if is_vision_available() else None






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  ConvNextImageProcessingTester(self      )






						@property
						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												return self.image_processor_tester.prepare_image_processor_dict()






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  self.image_processing_class(**self.image_processor_dict      )
												self.assertTrue(hasattr(a__   ,  'do_resize'      )      )
												self.assertTrue(hasattr(a__   ,  'size'      )      )
												self.assertTrue(hasattr(a__   ,  'crop_pct'      )      )
												self.assertTrue(hasattr(a__   ,  'do_normalize'      )      )
												self.assertTrue(hasattr(a__   ,  'image_mean'      )      )
												self.assertTrue(hasattr(a__   ,  'image_std'      )      )






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  self.image_processing_class.from_dict(self.image_processor_dict      )
												self.assertEqual(image_processor.size   ,  {'shortest_edge': 20}      )

												lowerCAmelCase__			  =  self.image_processing_class.from_dict(self.image_processor_dict   ,  size=42      )
												self.assertEqual(image_processor.size   ,  {'shortest_edge': 42}      )






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												pass






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  self.image_processing_class(**self.image_processor_dict      )
												# create random PIL images
												lowerCAmelCase__			  =  prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=a__      )
												for image in image_inputs:
																		self.assertIsInstance(a__   ,  Image.Image      )

												# Test not batched input
												lowerCAmelCase__			  =  image_processing(image_inputs[0]   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        1,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )

												# Test batched
												lowerCAmelCase__			  =  image_processing(a__   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        self.image_processor_tester.batch_size,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )






						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  self.image_processing_class(**self.image_processor_dict      )
												# create random numpy tensors
												lowerCAmelCase__			  =  prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=a__   ,  numpify=a__      )
												for image in image_inputs:
																		self.assertIsInstance(a__   ,  np.ndarray      )

												# Test not batched input
												lowerCAmelCase__			  =  image_processing(image_inputs[0]   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        1,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )

												# Test batched
												lowerCAmelCase__			  =  image_processing(a__   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        self.image_processor_tester.batch_size,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )







						def 					UpperCamelCase__					(		self      ):






												"""simple docstring"""
												lowerCAmelCase__			  =  self.image_processing_class(**self.image_processor_dict      )
												# create random PyTorch tensors
												lowerCAmelCase__			  =  prepare_image_inputs(self.image_processor_tester   ,  equal_resolution=a__   ,  torchify=a__      )
												for image in image_inputs:
																		self.assertIsInstance(a__   ,  torch.Tensor      )

												# Test not batched input
												lowerCAmelCase__			  =  image_processing(image_inputs[0]   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        1,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )

												# Test batched
												lowerCAmelCase__			  =  image_processing(a__   ,  return_tensors='pt'      ).pixel_values
												self.assertEqual(
												    encoded_images.shape   ,  (
												        self.image_processor_tester.batch_size,
												        self.image_processor_tester.num_channels,
												        self.image_processor_tester.size['shortest_edge'],
												        self.image_processor_tester.size['shortest_edge'],
												    )   ,  )









"""simple docstring"""


def    a__       ( __lowercase = 20      )		->		int:

				try:
								_A         =	int(__lowercase      )
				except (TypeError, ValueError):
								raise TypeError("Parameter n must be int or castable to int."      )
				if n <= 0:
								raise ValueError("Parameter n must be greater than or equal to one."      )
				_A         =	0
				while 1:
								i += n * (n - 1)
								_A         =	0
								for j in range(2   ,	__lowercase      ):
												if i % j != 0:
																_A         =	1
																break
								if nfound == 0:
												if i == 0:
																_A         =	1
												return i
				return None


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