"""simple docstring"""




from typing import List, Optional, Union

import numpy as np
import PIL.Image

from ...image_processing_utils import BaseImageProcessor, BatchFeature
from ...image_transforms import rescale, resize, to_channel_dimension_format
from ...image_utils import (
    ChannelDimension,
    PILImageResampling,
    get_image_size,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging


__lowerCAmelCase     :				Any    				=    logging.get_logger(__name__)

class    a_   (  __UpperCamelCase      ):
					UpperCamelCase_			:						Dict      =     ["pixel_values"]




					def __init__(						self    :  Optional[Any]	,    snake_case__    :  bool = True	,    snake_case__    :  int = 32	,    snake_case__    :  Optional[int]=PILImageResampling.BILINEAR	,    snake_case__    :  bool = True	,    **snake_case__    :  int	,    ):
							lowerCAmelCase__   = do_resize
							lowerCAmelCase__   = do_rescale
							lowerCAmelCase__   = size_divisor
							lowerCAmelCase__   = resample
							super().__init__(**snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[int]	,    snake_case__    :  np.ndarray	,    snake_case__    :  int	,    snake_case__    :  Union[str, Any]	,    snake_case__    :  Optional[ChannelDimension] = None	,    **snake_case__    :  List[str]  ):
							lowerCAmelCase__ ,       lowerCAmelCase__   = get_image_size(snake_case__  )
							# Rounds the height and width down to the closest multiple of size_divisor
							lowerCAmelCase__   = height // size_divisor * size_divisor
							lowerCAmelCase__   = width // size_divisor * size_divisor
							lowerCAmelCase__   = resize(snake_case__	,    (new_h, new_w)	,    resample=snake_case__	,    data_format=snake_case__	,    **snake_case__  )
							return image




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[Any]	,    snake_case__    :  np.ndarray	,    snake_case__    :  float	,    snake_case__    :  Optional[ChannelDimension] = None	,    **snake_case__    :  Any  ):
							return rescale(image=snake_case__	,    scale=snake_case__	,    data_format=snake_case__	,    **snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[Any]	,    snake_case__    :  Union["PIL.Image.Image", TensorType, List["PIL.Image.Image"], List[TensorType]]	,    snake_case__    :  Optional[bool] = None	,    snake_case__    :  Optional[int] = None	,    snake_case__    :  Any=None	,    snake_case__    :  Optional[bool] = None	,    snake_case__    :  Optional[Union[TensorType, str]] = None	,    snake_case__    :  ChannelDimension = ChannelDimension.FIRST	,    **snake_case__    :  str	,    ):
							lowerCAmelCase__   = do_resize if do_resize is not None else self.do_resize
							lowerCAmelCase__   = do_rescale if do_rescale is not None else self.do_rescale
							lowerCAmelCase__   = size_divisor if size_divisor is not None else self.size_divisor
							lowerCAmelCase__   = resample if resample is not None else self.resample

							if do_resize and size_divisor is None:
									raise ValueError("""size_divisor is required for resizing"""  )

							lowerCAmelCase__   = make_list_of_images(snake_case__  )

							if not valid_images(snake_case__  ):
									raise ValueError("""Invalid image(s)"""  )

							# All transformations expect numpy arrays.
							lowerCAmelCase__   = [to_numpy_array(snake_case__  ) for img in images]

							if do_resize:
									lowerCAmelCase__   = [self.resize(snake_case__	,    size_divisor=snake_case__	,    resample=snake_case__  ) for image in images]

							if do_rescale:
									lowerCAmelCase__   = [self.rescale(snake_case__	,    scale=1 / 255  ) for image in images]

							lowerCAmelCase__   = [to_channel_dimension_format(snake_case__	,    snake_case__  ) for image in images]

							lowerCAmelCase__   = {"""pixel_values""": images}
							return BatchFeature(data=snake_case__	,    tensor_type=snake_case__  )





"""simple docstring"""




def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		return abs(lowerCamelCase__  ) if a == 0 else greatest_common_divisor(b % a      ,	lowerCamelCase__  )







def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		while y:  # --> when y=0 then loop will terminate and return x as final GCD.
				lowerCAmelCase__ ,       lowerCAmelCase__   = y, x % y
		return abs(lowerCamelCase__  )







def 				_UpperCAmelCase		(							):





		"""simple docstring"""




		try:
				lowerCAmelCase__   = input("""Enter two integers separated by comma (,): """  ).split(""","""  )
				lowerCAmelCase__   = int(nums[0]  )
				lowerCAmelCase__   = int(nums[1]  )
				print(
				    f"""greatest_common_divisor({num_a}, {num_a}) = """
				    f"""{greatest_common_divisor(lowerCamelCase__      ,	lowerCamelCase__  )}"""  )
				print(f"""By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(lowerCamelCase__      ,	lowerCamelCase__  )}"""  )
		except (IndexError, UnboundLocalError, ValueError):
				print("""Wrong input"""  )


if __name__ == "__main__":
			main()




