




'''simple docstring'''
import numpy as np
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from PIL import Image





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_=256    )		->		Dict:
			A_       		=   min(img.size    )

			if s < target_image_size:
						raise ValueError(F'min dim for image {s} < {target_image_size}'    )

			A_       		=   target_image_size / s
			A_       		=   (round(r * img.size[1]    ), round(r * img.size[0]    ))
			A_       		=   TF.resize(SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_					,interpolation=PIL.Image.LANCZOS    )
			A_       		=   TF.center_crop(SCREAMING_SNAKE_CASE_					,output_size=2 * [target_image_size]    )
			A_       		=   torch.unsqueeze(T.ToTensor()(SCREAMING_SNAKE_CASE_    )					,0    )
			return img





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_    )		->		List[str]:
			A_       		=   2.0 * x - 1.0
			return x





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_=True					,SCREAMING_SNAKE_CASE_="RGB"    )		->		Any:
			A_       		=   x.detach().cpu()
			if process:
						A_       		=   post_process_tensor(SCREAMING_SNAKE_CASE_    )
			A_       		=   x.numpy()
			if process:
						A_       		=   (255 * x).astype(np.uinta    )
			A_       		=   Image.fromarray(SCREAMING_SNAKE_CASE_    )
			if not x.mode == mode:
						A_       		=   x.convert(SCREAMING_SNAKE_CASE_    )
			return x





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_    )		->		Optional[int]:
			A_       		=   torch.clamp(SCREAMING_SNAKE_CASE_					,-1.0					,1.0    )
			A_       		=   (x + 1.0) / 2.0
			A_       		=   x.permute(1					,2					,0    )
			return x






def  lowerCamelCase(       SCREAMING_SNAKE_CASE_    )		->		Optional[Any]:
			A_       		=   post_process_tensor(x.squeeze()    )
			return x.permute(2					,0					,1    ).unsqueeze(0    )










'''simple docstring'''
from __future__ import annotations

import sys





def  lowerCamelCase(       SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_    )		->		tuple[int, int]:
			# base cases
			if abs(SCREAMING_SNAKE_CASE_    ) == 1:
						return a, 0
			elif abs(SCREAMING_SNAKE_CASE_    ) == 1:
						return 0, b

			A_		,   A_       		=   a, b
			A_		,   A_       		=   1, 0
			A_		,   A_       		=   0, 1

			while remainder != 0:
						A_       		=   old_remainder // remainder
						A_		,   A_       		=   remainder, old_remainder - quotient * remainder
						A_		,   A_       		=   coeff_a, old_coeff_a - quotient * coeff_a
						A_		,   A_       		=   coeff_b, old_coeff_b - quotient * coeff_b

			# sign correction for negative numbers
			if a < 0:
						A_       		=   -old_coeff_a
			if b < 0:
						A_       		=   -old_coeff_b

			return old_coeff_a, old_coeff_b





def  lowerCamelCase(       )		->		Tuple:
			if len(sys.argv    ) < 3:
						print('2 integer arguments required'    )
						return 1
			A_       		=   int(sys.argv[1]    )
			A_       		=   int(sys.argv[2]    )
			print(extended_euclidean_algorithm(SCREAMING_SNAKE_CASE_					,SCREAMING_SNAKE_CASE_    )    )
			return 0


if __name__ == "__main__":
							raise SystemExit(main())




