


'''simple docstring'''






import unittest

import numpy as np

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

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 DPTImageProcessor






class    __magic_name__				(						unittest.TestCase							):






       def __init__(     self    ,				snake_case    ,				snake_case=7    ,				snake_case=3    ,				snake_case=1_8    ,				snake_case=3_0    ,				snake_case=4_0_0    ,				snake_case=True    ,				snake_case=None    ,				snake_case=True    ,				snake_case=[0.5, 0.5, 0.5]    ,				snake_case=[0.5, 0.5, 0.5]    ,				)		->    int:




          '''simple docstring'''
          _UpperCAmelCase  :  List[str]				       =size if size is not None else {'height': 1_8, 'width': 1_8}
          _UpperCAmelCase  :  Dict				       =parent
          _UpperCAmelCase  :  Dict				       =batch_size
          _UpperCAmelCase  :  Dict				       =num_channels
          _UpperCAmelCase  :  int				       =image_size
          _UpperCAmelCase  :  Any				       =min_resolution
          _UpperCAmelCase  :  List[str]				       =max_resolution
          _UpperCAmelCase  :  Optional[Any]				       =do_resize
          _UpperCAmelCase  :  Any				       =size
          _UpperCAmelCase  :  str				       =do_normalize
          _UpperCAmelCase  :  Optional[int]				       =image_mean
          _UpperCAmelCase  :  Tuple				       =image_std






       def      lowerCAmelCase						(     self)		->    Any:




          '''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,
          }






@require_torch
@require_vision
class    __magic_name__				(						lowerCAmelCase   ,unittest.TestCase							):
       UpperCAmelCase		 =DPTImageProcessor if is_vision_available() else None






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




          '''simple docstring'''
          _UpperCAmelCase  :  str				       =DPTImageProcessingTester(self)






       @property
       def      lowerCAmelCase						(     self)		->    Union[str, Any]:




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






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




          '''simple docstring'''
          _UpperCAmelCase  :  Optional[int]				       =self.image_processing_class(**self.image_processor_dict)
          self.assertTrue(hasattr(snake_case    ,				'image_mean'))
          self.assertTrue(hasattr(snake_case    ,				'image_std'))
          self.assertTrue(hasattr(snake_case    ,				'do_normalize'))
          self.assertTrue(hasattr(snake_case    ,				'do_resize'))
          self.assertTrue(hasattr(snake_case    ,				'size'))






       def      lowerCAmelCase						(     self)		->    List[Any]:




          '''simple docstring'''
          _UpperCAmelCase  :  Union[str, Any]				       =self.image_processing_class.from_dict(self.image_processor_dict)
          self.assertEqual(image_processor.size    ,				{'height': 1_8, 'width': 1_8})

          _UpperCAmelCase  :  List[str]				       =self.image_processing_class.from_dict(self.image_processor_dict    ,				size=4_2)
          self.assertEqual(image_processor.size    ,				{'height': 4_2, 'width': 4_2})






       def      lowerCAmelCase						(     self)		->    List[Any]:




          '''simple docstring'''
          # Initialize image_processing
          _UpperCAmelCase  :  Tuple				       =self.image_processing_class(**self.image_processor_dict)
          # create random PIL images
          _UpperCAmelCase  :  Optional[int]				       =prepare_image_inputs(self.image_processor_tester    ,				equal_resolution=snake_case)
          for image in image_inputs:
             self.assertIsInstance(snake_case    ,				Image.Image)

          # Test not batched input
          _UpperCAmelCase  :  Union[str, 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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)

          # Test batched
          _UpperCAmelCase  :  int				       =image_processing(snake_case    ,				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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)






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




          '''simple docstring'''
          # Initialize image_processing
          _UpperCAmelCase  :  Dict				       =self.image_processing_class(**self.image_processor_dict)
          # create random numpy tensors
          _UpperCAmelCase  :  Tuple				       =prepare_image_inputs(self.image_processor_tester    ,				equal_resolution=snake_case    ,				numpify=snake_case)
          for image in image_inputs:
             self.assertIsInstance(snake_case    ,				np.ndarray)

          # Test not batched input
          _UpperCAmelCase  :  Union[str, 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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)

          # Test batched
          _UpperCAmelCase  :  List[Any]				       =image_processing(snake_case    ,				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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)






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




          '''simple docstring'''
          # Initialize image_processing
          _UpperCAmelCase  :  List[Any]				       =self.image_processing_class(**self.image_processor_dict)
          # create random PyTorch tensors
          _UpperCAmelCase  :  Dict				       =prepare_image_inputs(self.image_processor_tester    ,				equal_resolution=snake_case    ,				torchify=snake_case)
          for image in image_inputs:
             self.assertIsInstance(snake_case    ,				torch.Tensor)

          # Test not batched input
          _UpperCAmelCase  :  Optional[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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)

          # Test batched
          _UpperCAmelCase  :  str				       =image_processing(snake_case    ,				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['height'],
                  self.image_processor_tester.size['width'],
              )    ,				)





'''simple docstring'''






from __future__ import annotations

from fractions import Fraction





def lowerCamelCase__     (		__lowerCamelCase			:				int			,       __lowerCamelCase			:				int				):







   '''simple docstring'''




   return (
       num != den and num % 1_0 == den // 1_0 and (num // 1_0) / (den % 1_0) == num / den
   )





def lowerCamelCase__     (		__lowerCamelCase			:				int				):







   '''simple docstring'''




   _UpperCAmelCase  :  Optional[int]				       =[]
   _UpperCAmelCase  :  Union[str, Any]				       =1_1
   _UpperCAmelCase  :  Union[str, Any]				       =int('1' + '0' * digit_len				)
   for num in range(__lowerCamelCase			,       __lowerCamelCase				):
      while den <= 9_9:
         if (num != den) and (num % 1_0 == den // 1_0) and (den % 1_0 != 0):
            if is_digit_cancelling(__lowerCamelCase			,       __lowerCamelCase				):
               solutions.append(f"{num}/{den}"				)
         den += 1
      num += 1
      _UpperCAmelCase  :  Optional[int]				       =1_0
   return solutions





def lowerCamelCase__     (		__lowerCamelCase			:				int = 2				):







   '''simple docstring'''




   _UpperCAmelCase  :  Any				       =1.0
   for fraction in fraction_list(__lowerCamelCase				):
      _UpperCAmelCase  :  List[str]				       =Fraction(__lowerCamelCase				)
      result *= frac.denominator / frac.numerator
   return int(__lowerCamelCase				)


if __name__ == "__main__":
 print(solution())

