"""simple docstring"""


import unittest

import numpy as np
import PIL
import torch

from diffusers.image_processor import VaeImageProcessor




class 					UpperCamelCase   (							unittest.TestCase  ):







       @property
       def 						a_		(					self) -> Optional[Any]:
            snake_case_   			=   1
            snake_case_   			=   3
            snake_case_   			=   8
            snake_case_   			=   8

            snake_case_   			=   torch.rand((batch_size, num_channels, height, width))

            return sample







       def 						a_		(					self,				lowerCAmelCase__) -> Union[str, Any]:
            if isinstance(image[0],				PIL.Image.Image):
                 return np.stack([np.array(lowerCAmelCase__) for i in image],				axis=0)
            elif isinstance(lowerCAmelCase__,				torch.Tensor):
                 return image.cpu().numpy().transpose(0,				2,				3,				1)
            return image







       def 						a_		(					self) -> List[Any]:
            snake_case_   			=   VaeImageProcessor(do_resize=lowerCAmelCase__,				do_normalize=lowerCAmelCase__)

            snake_case_   			=   self.dummy_sample
            snake_case_   			=   self.to_np(lowerCAmelCase__)

            for output_type in ["pt", "np", "pil"]:
                 snake_case_   			=   image_processor.postprocess(
                     image_processor.preprocess(lowerCAmelCase__),				output_type=lowerCAmelCase__,				)
                 snake_case_   			=   self.to_np(lowerCAmelCase__)
                 snake_case_   			=   (input_np * 255).round() if output_type == 'pil' else input_np
                 assert (
                     np.abs(in_np - out_np).max() < 1e-6
                 ), f'decoded output does not match input for output_type {output_type}'







       def 						a_		(					self) -> Tuple:
            snake_case_   			=   VaeImageProcessor(do_resize=lowerCAmelCase__,				do_normalize=lowerCAmelCase__)
            snake_case_   			=   self.dummy_sample.cpu().numpy().transpose(0,				2,				3,				1)

            for output_type in ["pt", "np", "pil"]:
                 snake_case_   			=   image_processor.postprocess(image_processor.preprocess(lowerCAmelCase__),				output_type=lowerCAmelCase__)

                 snake_case_   			=   self.to_np(lowerCAmelCase__)
                 snake_case_   			=   (input_np * 255).round() if output_type == 'pil' else input_np
                 assert (
                     np.abs(in_np - out_np).max() < 1e-6
                 ), f'decoded output does not match input for output_type {output_type}'







       def 						a_		(					self) -> List[Any]:
            snake_case_   			=   VaeImageProcessor(do_resize=lowerCAmelCase__,				do_normalize=lowerCAmelCase__)

            snake_case_   			=   self.dummy_sample.cpu().numpy().transpose(0,				2,				3,				1)
            snake_case_   			=   image_processor.numpy_to_pil(lowerCAmelCase__)

            for output_type in ["pt", "np", "pil"]:
                 snake_case_   			=   image_processor.postprocess(image_processor.preprocess(lowerCAmelCase__),				output_type=lowerCAmelCase__)
                 for i, o in zip(lowerCAmelCase__,				lowerCAmelCase__):
                      snake_case_   			=   np.array(lowerCAmelCase__)
                      snake_case_   			=   self.to_np(lowerCAmelCase__) if output_type == 'pil' else (self.to_np(lowerCAmelCase__) * 255).round()
                      assert (
                          np.abs(in_np - out_np).max() < 1e-6
                      ), f'decoded output does not match input for output_type {output_type}'







       def 						a_		(					self) -> Dict:
            snake_case_   			=   VaeImageProcessor(do_resize=lowerCAmelCase__,				do_normalize=lowerCAmelCase__)

            snake_case_   			=   self.dummy_sample
            snake_case_   			=   input_pt_ad.squeeze(0)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)
            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            snake_case_   			=   self.to_np(self.dummy_sample)
            snake_case_   			=   input_np_ad.squeeze(0)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)
            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            assert np.abs(out_pt_ad - out_pt_ad).max() < 1e-6
            assert np.abs(out_np_ad - out_np_ad).max() < 1e-6







       def 						a_		(					self) -> Any:
            snake_case_   			=   VaeImageProcessor(do_resize=lowerCAmelCase__,				do_normalize=lowerCAmelCase__)

            snake_case_   			=   self.dummy_sample
            snake_case_   			=   list(lowerCAmelCase__)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            snake_case_   			=   self.to_np(self.dummy_sample)
            list(lowerCAmelCase__)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            snake_case_   			=   image_processor.postprocess(
                image_processor.preprocess(lowerCAmelCase__),				output_type='np',				)

            assert np.abs(out_pt_ad - out_pt_list).max() < 1e-6
            assert np.abs(out_np_ad - out_np_list).max() < 1e-6


"""simple docstring"""


from math import factorial







def    UpperCAmelCase       (						UpperCAmelCase		,   UpperCAmelCase   )							-> List[str]:
     return factorial(UpperCAmelCase   ) / (factorial(UpperCAmelCase   ) * factorial(n - r   ))







def    UpperCAmelCase       (						)							-> Optional[Any]:
     snake_case_   			=   0

     for i in range(1		,   101   ):
          for j in range(1		,   i + 1   ):
               if combinations(UpperCAmelCase		,   UpperCAmelCase   ) > 1e6:
                    total += 1
     return total


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

