





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 ViTImageProcessor



class 					A__   (       unittest.TestCase			):





      def __init__( self       ,							A_       ,							A_=13       ,							A_=3       ,							A_=224       ,							A_=30       ,							A_=400       ,							A_=True       ,							A_=None       ,							A_=True       ,							A_=[0.5, 0.5, 0.5]       ,							A_=[0.5, 0.5, 0.5]       ,							):
       '''simple docstring'''




       UpperCamelCase	:					Any       	=   size if size is not None else {"height": 18, "width": 18}
       UpperCamelCase	:					List[str]       	=   parent
       UpperCamelCase	:					int       	=   batch_size
       UpperCamelCase	:					Optional[int]       	=   num_channels
       UpperCamelCase	:					Union[str, Any]       	=   image_size
       UpperCamelCase	:					Tuple       	=   min_resolution
       UpperCamelCase	:					Union[str, Any]       	=   max_resolution
       UpperCamelCase	:					str       	=   do_resize
       UpperCamelCase	:					str       	=   size
       UpperCamelCase	:					List[Any]       	=   do_normalize
       UpperCamelCase	:					Optional[int]       	=   image_mean
       UpperCamelCase	:					Optional[Any]       	=   image_std





      def        __UpperCamelCase( self   ):
       '''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 					A__   (       __snake_case       ,   unittest.TestCase			):
      _UpperCAmelCase	:int						    =   ViTImageProcessor if is_vision_available() else None





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       UpperCamelCase	:					Optional[int]       	=   EfficientFormerImageProcessorTester(self   )





      @property
      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       return self.image_proc_tester.prepare_image_processor_dict()





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       UpperCamelCase	:					Optional[Any]       	=   self.image_processing_class(**self.image_processor_dict   )
       self.assertTrue(hasattr(A_       ,							"image_mean"   )   )
       self.assertTrue(hasattr(A_       ,							"image_std"   )   )
       self.assertTrue(hasattr(A_       ,							"do_normalize"   )   )
       self.assertTrue(hasattr(A_       ,							"do_resize"   )   )
       self.assertTrue(hasattr(A_       ,							"size"   )   )





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       pass





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       UpperCamelCase	:					List[Any]       	=   self.image_processing_class(**self.image_processor_dict   )
       # create random PIL images
       UpperCamelCase	:					Optional[int]       	=   prepare_image_inputs(self.image_proc_tester       ,							equal_resolution=A_   )
       for image in image_inputs:
        self.assertIsInstance(A_       ,							Image.Image   )

       # Test not batched input
       UpperCamelCase	:					Tuple       	=   image_processor(image_inputs[0]       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               1,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)

       # Test batched
       UpperCamelCase	:					int       	=   image_processor(A_       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               self.image_proc_tester.batch_size,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       UpperCamelCase	:					str       	=   self.image_processing_class(**self.image_processor_dict   )
       # create random numpy tensors
       UpperCamelCase	:					List[str]       	=   prepare_image_inputs(self.image_proc_tester       ,							equal_resolution=A_       ,							numpify=A_   )
       for image in image_inputs:
        self.assertIsInstance(A_       ,							np.ndarray   )

       # Test not batched input
       UpperCamelCase	:					str       	=   image_processor(image_inputs[0]       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               1,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)

       # Test batched
       UpperCamelCase	:					str       	=   image_processor(A_       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               self.image_proc_tester.batch_size,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)





      def        __UpperCamelCase( self   ):
       '''simple docstring'''




       UpperCamelCase	:					Optional[Any]       	=   self.image_processing_class(**self.image_processor_dict   )
       # create random PyTorch tensors
       UpperCamelCase	:					Optional[Any]       	=   prepare_image_inputs(self.image_proc_tester       ,							equal_resolution=A_       ,							torchify=A_   )
       for image in image_inputs:
        self.assertIsInstance(A_       ,							torch.Tensor   )

       # Test not batched input
       UpperCamelCase	:					List[str]       	=   image_processor(image_inputs[0]       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               1,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)

       # Test batched
       UpperCamelCase	:					Dict       	=   image_processor(A_       ,							return_tensors="pt"   ).pixel_values
       self.assertEqual(
           encoded_images.shape       ,							(
               self.image_proc_tester.batch_size,
               self.image_proc_tester.num_channels,
               self.image_proc_tester.size["height"],
               self.image_proc_tester.size["width"],
           )       ,							)







def 		A_				(     _lowerCAmelCase = 50     )						-> int:
 UpperCamelCase	:					List[Any]       	=   [[0] * 3 for _ in range(length + 1     )]

 for row_length in range(length + 1     ):
  for tile_length in range(2							,   5     ):
   for tile_start in range(row_length - tile_length + 1     ):
    different_colour_ways_number[row_length][tile_length - 2] += (
        different_colour_ways_number[row_length - tile_start - tile_length][
            tile_length - 2
        ]
        + 1
    )

 return sum(different_colour_ways_number[length]     )


if __name__ == "__main__":
    print(f"""{solution() = }""")
