





'''simple docstring'''







def     lowerCamelCase_ (					SCREAMING_SNAKE_CASE__ :     int = 100,     SCREAMING_SNAKE_CASE__ :     int = 100				)	->		int:
						return max(
						    sum(int(SCREAMING_SNAKE_CASE__				) for x in str(base**power				)				)
						    for base in range(SCREAMING_SNAKE_CASE__				)
						    for power in range(SCREAMING_SNAKE_CASE__				)				)


# Tests
if __name__ == "__main__":
					import doctest

					doctest.testmod()












'''simple docstring'''







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

							def __init__(							self							:       Dict    ,       __magic_name__							:       List[str]    ,       __magic_name__							:       str=7    ,       __magic_name__							:       Optional[int]=3    ,       __magic_name__							:       Union[str, Any]=18    ,       __magic_name__							:       Dict=30    ,       __magic_name__							:       List[Any]=4_00    ,       __magic_name__							:       Dict=True    ,       __magic_name__							:       Union[str, Any]=None    ,       __magic_name__							:       Optional[Any]=0.8_7_5    ,       __magic_name__							:       List[Any]=True    ,       __magic_name__							:       Optional[int]=[0.5, 0.5, 0.5]    ,       __magic_name__							:       Optional[int]=[0.5, 0.5, 0.5]    ,       )   ->    Optional[Any]:







													"""simple docstring"""
													UpperCAmelCase_     : str         =					size if size is not None else {'''shortest_edge''': 20}
													UpperCAmelCase_     : Optional[Any]         =					parent
													UpperCAmelCase_     : Any         =					batch_size
													UpperCAmelCase_     : Optional[Any]         =					num_channels
													UpperCAmelCase_     : Optional[Any]         =					image_size
													UpperCAmelCase_     : Optional[int]         =					min_resolution
													UpperCAmelCase_     : Optional[Any]         =					max_resolution
													UpperCAmelCase_     : Optional[int]         =					do_resize
													UpperCAmelCase_     : Optional[Any]         =					size
													UpperCAmelCase_     : int         =					crop_pct
													UpperCAmelCase_     : Optional[int]         =					do_normalize
													UpperCAmelCase_     : Dict         =					image_mean
													UpperCAmelCase_     : int         =					image_std



							def       UpperCAmelCase__		(							self							:       Optional[int]				)   ->    int:







													"""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    __a (lowerCamelCase    ,						unittest.TestCase       ):
							__a   :				Dict       =    ConvNextImageProcessor if is_vision_available() else None

							def       UpperCAmelCase__		(							self							:       Optional[int]				)   ->    Dict:







													"""simple docstring"""
													UpperCAmelCase_     : str         =					ConvNextImageProcessingTester(self				)

							@property
							def       UpperCAmelCase__		(							self							:       List[Any]				)   ->    Any:







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

							def       UpperCAmelCase__		(							self							:       List[Any]				)   ->    Tuple:







													"""simple docstring"""
													UpperCAmelCase_     : Dict         =					self.image_processing_class(**self.image_processor_dict				)
													self.assertTrue(hasattr(__magic_name__    ,       '''do_resize'''				)				)
													self.assertTrue(hasattr(__magic_name__    ,       '''size'''				)				)
													self.assertTrue(hasattr(__magic_name__    ,       '''crop_pct'''				)				)
													self.assertTrue(hasattr(__magic_name__    ,       '''do_normalize'''				)				)
													self.assertTrue(hasattr(__magic_name__    ,       '''image_mean'''				)				)
													self.assertTrue(hasattr(__magic_name__    ,       '''image_std'''				)				)

							def       UpperCAmelCase__		(							self							:       Dict				)   ->    List[Any]:







													"""simple docstring"""
													UpperCAmelCase_     : List[str]         =					self.image_processing_class.from_dict(self.image_processor_dict				)
													self.assertEqual(image_processor.size    ,       {'''shortest_edge''': 20}				)

													UpperCAmelCase_     : List[Any]         =					self.image_processing_class.from_dict(self.image_processor_dict    ,       size=42				)
													self.assertEqual(image_processor.size    ,       {'''shortest_edge''': 42}				)

							def       UpperCAmelCase__		(							self							:       str				)   ->    Optional[int]:







													"""simple docstring"""
													pass

							def       UpperCAmelCase__		(							self							:       List[str]				)   ->    int:







													"""simple docstring"""
													# Initialize image_processing
													UpperCAmelCase_     : int         =					self.image_processing_class(**self.image_processor_dict				)
													# create random PIL images
													UpperCAmelCase_     : List[Any]         =					prepare_image_inputs(self.image_processor_tester    ,       equal_resolution=__magic_name__				)
													for image in image_inputs:
																			self.assertIsInstance(__magic_name__    ,       Image.Image				)

													# Test not batched input
													UpperCAmelCase_     : int         =					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
													UpperCAmelCase_     : Tuple         =					image_processing(__magic_name__    ,       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							:       str				)   ->    Optional[int]:







													"""simple docstring"""
													# Initialize image_processing
													UpperCAmelCase_     : Optional[Any]         =					self.image_processing_class(**self.image_processor_dict				)
													# create random numpy tensors
													UpperCAmelCase_     : Tuple         =					prepare_image_inputs(self.image_processor_tester    ,       equal_resolution=__magic_name__    ,       numpify=__magic_name__				)
													for image in image_inputs:
																			self.assertIsInstance(__magic_name__    ,       np.ndarray				)

													# Test not batched input
													UpperCAmelCase_     : int         =					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
													UpperCAmelCase_     : Union[str, Any]         =					image_processing(__magic_name__    ,       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							:       str				)   ->    int:







													"""simple docstring"""
													# Initialize image_processing
													UpperCAmelCase_     : Union[str, Any]         =					self.image_processing_class(**self.image_processor_dict				)
													# create random PyTorch tensors
													UpperCAmelCase_     : List[Any]         =					prepare_image_inputs(self.image_processor_tester    ,       equal_resolution=__magic_name__    ,       torchify=__magic_name__				)
													for image in image_inputs:
																			self.assertIsInstance(__magic_name__    ,       torch.Tensor				)

													# Test not batched input
													UpperCAmelCase_     : List[Any]         =					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
													UpperCAmelCase_     : str         =					image_processing(__magic_name__    ,       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'''],
													    )    ,       )





