
"""simple docstring"""
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 MobileViTImageProcessor
class       UpperCamelCase   (				unittest.TestCase	):
     def __init__(  self	,  snake_case__	,  snake_case__=7	,  snake_case__=3	,  snake_case__=18	,  snake_case__=30	,  snake_case__=400	,  snake_case__=True	,  snake_case__=None	,  snake_case__=True	,  snake_case__=None	,  snake_case__=True	,  ):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					Union[str, Any]				     =			size if size is not None else {"shortest_edge": 20}
       _SCREAMING_SNAKE_CASE :					Tuple				     =			crop_size if crop_size is not None else {"height": 18, "width": 18}
       _SCREAMING_SNAKE_CASE :					Union[str, Any]				     =			parent
       _SCREAMING_SNAKE_CASE :					Union[str, Any]				     =			batch_size
       _SCREAMING_SNAKE_CASE :					List[str]				     =			num_channels
       _SCREAMING_SNAKE_CASE :					Any				     =			image_size
       _SCREAMING_SNAKE_CASE :					str				     =			min_resolution
       _SCREAMING_SNAKE_CASE :					Tuple				     =			max_resolution
       _SCREAMING_SNAKE_CASE :					Optional[int]				     =			do_resize
       _SCREAMING_SNAKE_CASE :					int				     =			size
       _SCREAMING_SNAKE_CASE :					Tuple				     =			do_center_crop
       _SCREAMING_SNAKE_CASE :					str				     =			crop_size
       _SCREAMING_SNAKE_CASE :					Optional[Any]				     =			do_flip_channel_order




     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       return {
           "do_resize": self.do_resize,
           "size": self.size,
           "do_center_crop": self.do_center_crop,
           "crop_size": self.crop_size,
           "do_flip_channel_order": self.do_flip_channel_order,
       }
@require_torch
@require_vision
class       UpperCamelCase   (				_lowercase   ,							unittest.TestCase	):
     A__			  =      MobileViTImageProcessor if is_vision_available() else None
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					int				     =			MobileViTImageProcessingTester(self					)
     @property
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       return self.image_processor_tester.prepare_image_processor_dict()
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					List[str]				     =			self.image_processing_class(**self.image_processor_dict					)
       self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE	,  "do_resize"					)					)
       self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE	,  "size"					)					)
       self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE	,  "do_center_crop"					)					)
       self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE	,  "center_crop"					)					)
       self.assertTrue(hasattr(__SCREAMING_SNAKE_CASE	,  "do_flip_channel_order"					)					)
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					Optional[Any]				     =			self.image_processing_class.from_dict(self.image_processor_dict					)
       self.assertEqual(image_processor.size	,  {"shortest_edge": 20}					)
       self.assertEqual(image_processor.crop_size	,  {"height": 18, "width": 18}					)

       _SCREAMING_SNAKE_CASE :					Dict				     =			self.image_processing_class.from_dict(self.image_processor_dict	,  size=42	,  crop_size=84					)
       self.assertEqual(image_processor.size	,  {"shortest_edge": 42}					)
       self.assertEqual(image_processor.crop_size	,  {"height": 84, "width": 84}					)
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       pass
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					Dict				     =			self.image_processing_class(**self.image_processor_dict					)
       # create random PIL images
       _SCREAMING_SNAKE_CASE :					List[Any]				     =			prepare_image_inputs(self.image_processor_tester	,  equal_resolution=__SCREAMING_SNAKE_CASE					)
       for image in image_inputs:
         self.assertIsInstance(__SCREAMING_SNAKE_CASE	,  Image.Image					)

       # Test not batched input
       _SCREAMING_SNAKE_CASE :					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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )

       # Test batched
       _SCREAMING_SNAKE_CASE :					Dict				     =			image_processing(__SCREAMING_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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )
     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					List[Any]				     =			self.image_processing_class(**self.image_processor_dict					)
       # create random numpy tensors
       _SCREAMING_SNAKE_CASE :					Any				     =			prepare_image_inputs(self.image_processor_tester	,  equal_resolution=__SCREAMING_SNAKE_CASE	,  numpify=__SCREAMING_SNAKE_CASE					)
       for image in image_inputs:
         self.assertIsInstance(__SCREAMING_SNAKE_CASE	,  np.ndarray					)

       # Test not batched input
       _SCREAMING_SNAKE_CASE :					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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )

       # Test batched
       _SCREAMING_SNAKE_CASE :					Any				     =			image_processing(__SCREAMING_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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )




     def 					__SCREAMING_SNAKE_CASE				(  self					):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE :					List[Any]				     =			self.image_processing_class(**self.image_processor_dict					)
       # create random PyTorch tensors
       _SCREAMING_SNAKE_CASE :					Tuple				     =			prepare_image_inputs(self.image_processor_tester	,  equal_resolution=__SCREAMING_SNAKE_CASE	,  torchify=__SCREAMING_SNAKE_CASE					)
       for image in image_inputs:
         self.assertIsInstance(__SCREAMING_SNAKE_CASE	,  torch.Tensor					)

       # Test not batched input
       _SCREAMING_SNAKE_CASE :					Tuple				     =			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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )

       # Test batched
       _SCREAMING_SNAKE_CASE :					List[str]				     =			image_processing(__SCREAMING_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.crop_size["height"],
               self.image_processor_tester.crop_size["width"],
           )	,  )





"""simple docstring"""




from itertools import product



def     __magic_name__		(					UpperCamelCase     :		int							,		UpperCamelCase     :		int     )     ->						list[int]:
    a__		=			sides_number
    a__		=			max_face_number * dice_number
    a__		=			[0] * (max_total + 1)

    a__		=			1
    a__		=			range(UpperCamelCase							,		max_face_number + 1     )
    for dice_numbers in product(UpperCamelCase							,		repeat=UpperCamelCase     ):
        a__		=			sum(UpperCamelCase     )
        totals_frequencies[total] += 1

    return totals_frequencies



def     __magic_name__		(					)     ->						float:
    a__		=			total_frequency_distribution(
        sides_number=4							,		dice_number=9     )
    a__		=			total_frequency_distribution(
        sides_number=6							,		dice_number=6     )

    a__		=			0
    a__		=			9
    a__		=			4 * 9
    a__		=			6
    for peter_total in range(UpperCamelCase							,		max_peter_total + 1     ):
        peter_wins_count += peter_totals_frequencies[peter_total] * sum(
            colin_totals_frequencies[min_colin_total:peter_total]     )

    a__		=			(4**9) * (6**6)
    a__		=			peter_wins_count / total_games_number

    a__		=			round(UpperCamelCase							,		ndigits=7     )

    return rounded_peter_win_probability


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


