code: 
  
  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 ViltImageProcessor
  
  
  class _lowercase					(       unittest.TestCase						):
  
  
  
  
  
  							"""simple docstring"""
  
  
  
  
  							def __init__(    self     ,   UpperCAmelCase     ,   UpperCAmelCase=7     ,   UpperCAmelCase=3     ,   UpperCAmelCase=18     ,   UpperCAmelCase=30     ,   UpperCAmelCase=400     ,   UpperCAmelCase=True     ,   UpperCAmelCase=None     ,   UpperCAmelCase=2     ,   UpperCAmelCase=True     ,   UpperCAmelCase=[0.5, 0.5, 0.5]     ,   UpperCAmelCase=[0.5, 0.5, 0.5]     ,   ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	size if size is not None else {"""shortest_edge""": 30}
  														_lowercase				=	parent
  														_lowercase				=	batch_size
  														_lowercase				=	num_channels
  														_lowercase				=	image_size
  														_lowercase				=	min_resolution
  														_lowercase				=	max_resolution
  														_lowercase				=	do_resize
  														_lowercase				=	size
  														_lowercase				=	size_divisor
  														_lowercase				=	do_normalize
  														_lowercase				=	image_mean
  														_lowercase				=	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,
  														    "size_divisor": self.size_divisor,
  														}
  
  
  
  							def     _UpperCAmelCase       (    self     ,   UpperCAmelCase     ,   UpperCAmelCase=False  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														if not batched:
  																					_lowercase				=	self.size["""shortest_edge"""]
  																					_lowercase				=	image_inputs[0]
  																					if isinstance(a_     ,   Image.Image  ):
  																												_lowercase				,       _lowercase				=	image.size
  																					else:
  																												_lowercase				,       _lowercase				=	image.shape[1], image.shape[2]
  																					_lowercase				=	size / min(a_     ,   a_  )
  																					if h < w:
  																												_lowercase				,       _lowercase				=	size, scale * w
  																					else:
  																												_lowercase				,       _lowercase				=	scale * h, size
  
  																					_lowercase				=	int((1333 / 800) * size  )
  																					if max(a_     ,   a_  ) > max_size:
  																												_lowercase				=	max_size / max(a_     ,   a_  )
  																												_lowercase				=	newh * scale
  																												_lowercase				=	neww * scale
  
  																					_lowercase				,       _lowercase				=	int(newh + 0.5  ), int(neww + 0.5  )
  																					_lowercase				,       _lowercase				=	(
  																					    newh // self.size_divisor * self.size_divisor,
  																					    neww // self.size_divisor * self.size_divisor,
  																					)
  
  														else:
  																					_lowercase				=	[]
  																					for image in image_inputs:
  																												_lowercase				,       _lowercase				=	self.get_expected_values([image]  )
  																												expected_values.append((expected_height, expected_width)  )
  																					_lowercase				=	max(a_     ,   key=lambda UpperCAmelCase  : item[0]  )[0]
  																					_lowercase				=	max(a_     ,   key=lambda UpperCAmelCase  : item[1]  )[1]
  
  														return expected_height, expected_width
  
  
  
  
  
  
  @require_torch
  @require_vision
  class _lowercase					(       _UpperCAmelCase   ,				unittest.TestCase						):
  
  
  
  
  
  							"""simple docstring"""
  
  
  
  
  							lowerCAmelCase__       =					ViltImageProcessor if is_vision_available() else None
  
  
  
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	ViltImageProcessingTester(self  )
  
  
  
  							@property
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														return self.image_processor_tester.prepare_image_processor_dict()
  
  
  
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	self.image_processing_class(**self.image_processor_dict  )
  														self.assertTrue(hasattr(a_     ,   """image_mean"""  )  )
  														self.assertTrue(hasattr(a_     ,   """image_std"""  )  )
  														self.assertTrue(hasattr(a_     ,   """do_normalize"""  )  )
  														self.assertTrue(hasattr(a_     ,   """do_resize"""  )  )
  														self.assertTrue(hasattr(a_     ,   """size"""  )  )
  														self.assertTrue(hasattr(a_     ,   """size_divisor"""  )  )
  
  
  
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	self.image_processing_class.from_dict(self.image_processor_dict  )
  														self.assertEqual(image_processor.size     ,   {"""shortest_edge""": 30}  )
  
  														_lowercase				=	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'''
  
  
  
  
  
  
  														_lowercase				=	self.image_processing_class(**self.image_processor_dict  )
  														# create random PIL images
  														_lowercase				=	prepare_image_inputs(self.image_processor_tester     ,   equal_resolution=a_  )
  														for image in image_inputs:
  																					self.assertIsInstance(a_     ,   Image.Image  )
  
  														# Test not batched input
  														_lowercase				=	image_processing(image_inputs[0]     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (1, self.image_processor_tester.num_channels, expected_height, expected_width)     ,   )
  
  														# Test batched
  														_lowercase				=	image_processing(a_     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_     ,   batched=a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (
  														        self.image_processor_tester.batch_size,
  														        self.image_processor_tester.num_channels,
  														        expected_height,
  														        expected_width,
  														    )     ,   )
  
  
  
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	self.image_processing_class(**self.image_processor_dict  )
  														# create random numpy tensors
  														_lowercase				=	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
  														_lowercase				=	image_processing(image_inputs[0]     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (1, self.image_processor_tester.num_channels, expected_height, expected_width)     ,   )
  
  														# Test batched
  														_lowercase				=	image_processing(a_     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_     ,   batched=a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (
  														        self.image_processor_tester.batch_size,
  														        self.image_processor_tester.num_channels,
  														        expected_height,
  														        expected_width,
  														    )     ,   )
  
  
  
  							def     _UpperCAmelCase       (    self  ):
  
  
  
  
  
  
  
  														'''simple docstring'''
  
  
  
  
  
  
  														_lowercase				=	self.image_processing_class(**self.image_processor_dict  )
  														# create random PyTorch tensors
  														_lowercase				=	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
  														_lowercase				=	image_processing(image_inputs[0]     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (1, self.image_processor_tester.num_channels, expected_height, expected_width)     ,   )
  
  														# Test batched
  														_lowercase				=	image_processing(a_     ,   return_tensors="""pt"""  ).pixel_values
  
  														_lowercase				,       _lowercase				=	self.image_processor_tester.get_expected_values(a_     ,   batched=a_  )
  														self.assertEqual(
  														    encoded_images.shape     ,   (
  														        self.image_processor_tester.batch_size,
  														        self.image_processor_tester.num_channels,
  														        expected_height,
  														        expected_width,
  														    )     ,   )
  
  
  
style_context: def 					__lowerCAmelCase			(  _A = 998_001					):
  
  
  
  							"""simple docstring"""
  
  
  							_lowercase				=	0
  							for i in range(999 ,99 ,-1					):  # 3 digit numbers range from 999 down to 100
  														for j in range(999 ,99 ,-1					):
  																					_lowercase				=	str(i * j					)
  																					if product_string == product_string[::-1] and i * j < n:
  																												_lowercase				=	max(_A ,i * j					)
  							return answer
  
  
  if __name__ == "__main__":
  				print(F'''{solution() = }''')
  
  
  