
from __future__ import annotations

import copy
import inspect
import json
import math
import os
import tempfile
import unittest
from importlib import import_module

import numpy as np

from transformers import ViTMAEConfig
from transformers.file_utils import cached_property, is_tf_available, is_vision_available
from transformers.testing_utils import require_tf, require_vision, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers import TFViTMAEForPreTraining, TFViTMAEModel


if is_vision_available():
  from PIL import Image

  from transformers import ViTImageProcessor




class 				lowerCamelCase__							:




 '''simple docstring'''




 def __init__(      self	:List[Any]  ,     a	:str  ,     a	:Union[str, Any]=1_3  ,     a	:List[Any]=3_0  ,     a	:str=2  ,     a	:str=3  ,     a	:Any=True  ,     a	:List[Any]=True  ,     a	:Any=3_2  ,     a	:List[Any]=2  ,     a	:str=4  ,     a	:List[Any]=3_7  ,     a	:Dict="gelu"  ,     a	:Tuple=0.1  ,     a	:List[Any]=0.1  ,     a	:Tuple=1_0  ,     a	:Optional[int]=0.02  ,     a	:Any=3  ,     a	:str=0.6  ,     a	:Optional[int]=None  ,     )	->				Any:
        __UpperCamelCase			:     int         =      parent
        __UpperCamelCase			:     Tuple         =      batch_size
        __UpperCamelCase			:     List[str]         =      image_size
        __UpperCamelCase			:     Any         =      patch_size
        __UpperCamelCase			:     int         =      num_channels
        __UpperCamelCase			:     int         =      is_training
        __UpperCamelCase			:     Tuple         =      use_labels
        __UpperCamelCase			:     Optional[Any]         =      hidden_size
        __UpperCamelCase			:     int         =      num_hidden_layers
        __UpperCamelCase			:     Any         =      num_attention_heads
        __UpperCamelCase			:     List[str]         =      intermediate_size
        __UpperCamelCase			:     Dict         =      hidden_act
        __UpperCamelCase			:     List[str]         =      hidden_dropout_prob
        __UpperCamelCase			:     Any         =      attention_probs_dropout_prob
        __UpperCamelCase			:     Any         =      type_sequence_label_size
        __UpperCamelCase			:     int         =      initializer_range
        __UpperCamelCase			:     int         =      mask_ratio
        __UpperCamelCase			:     Union[str, Any]         =      scope

        # in ViTMAE, the expected sequence length = (num_patches + 1) * (1 - config.mask_ratio), rounded above
        # (we add 1 for the [CLS] token)
        __UpperCamelCase			:     int         =      (image_size // patch_size) ** 2
        __UpperCamelCase			:     Any         =      int(math.ceil((1 - mask_ratio) * (num_patches + 1)		)		)







 def      _lowerCamelCase       (      self	:Any		)	->				str:
        __UpperCamelCase			:     Dict         =      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]		)

        __UpperCamelCase			:     List[Any]         =      None
        if self.use_labels:
               __UpperCamelCase			:     List[str]         =      ids_tensor([self.batch_size]  ,     self.type_sequence_label_size		)

        __UpperCamelCase			:     Dict         =      self.get_config()

        return config, pixel_values, labels







 def      _lowerCamelCase       (      self	:Optional[Any]		)	->				Optional[Any]:
        return ViTMAEConfig(
            image_size=self.image_size  ,     patch_size=self.patch_size  ,     num_channels=self.num_channels  ,     hidden_size=self.hidden_size  ,     num_hidden_layers=self.num_hidden_layers  ,     num_attention_heads=self.num_attention_heads  ,     intermediate_size=self.intermediate_size  ,     decoder_hidden_size=self.hidden_size  ,     decoder_num_hidden_layers=self.num_hidden_layers  ,     decoder_num_attention_heads=self.num_attention_heads  ,     decoder_intermediate_size=self.intermediate_size  ,     hidden_act=self.hidden_act  ,     hidden_dropout_prob=self.hidden_dropout_prob  ,     attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,     is_decoder=snake_case_  ,     initializer_range=self.initializer_range  ,     mask_ratio=self.mask_ratio  ,     )







 def      _lowerCamelCase       (      self	:Union[str, Any]  ,     a	:List[Any]  ,     a	:Optional[Any]  ,     a	:List[str]		)	->				int:
        __UpperCamelCase			:     Dict         =      TFViTMAEModel(config=snake_case_		)
        __UpperCamelCase			:     Optional[Any]         =      model(snake_case_  ,     training=snake_case_		)
        self.parent.assertEqual(result.last_hidden_state.shape  ,     (self.batch_size, self.seq_length, self.hidden_size)		)







 def      _lowerCamelCase       (      self	:Union[str, Any]  ,     a	:str  ,     a	:Tuple  ,     a	:str		)	->				str:
        __UpperCamelCase			:     str         =      TFViTMAEForPreTraining(snake_case_		)
        __UpperCamelCase			:     Any         =      model(snake_case_  ,     training=snake_case_		)
        # expected sequence length = num_patches
        __UpperCamelCase			:     List[str]         =      (self.image_size // self.patch_size) ** 2
        __UpperCamelCase			:     int         =      self.patch_size**2 * self.num_channels
        self.parent.assertEqual(result.logits.shape  ,     (self.batch_size, num_patches, expected_num_channels)		)

        # test greyscale images
        __UpperCamelCase			:     List[Any]         =      1
        __UpperCamelCase			:     Union[str, Any]         =      TFViTMAEForPreTraining(snake_case_		)

        __UpperCamelCase			:     int         =      floats_tensor([self.batch_size, 1, self.image_size, self.image_size]		)
        __UpperCamelCase			:     List[Any]         =      model(snake_case_  ,     training=snake_case_		)
        __UpperCamelCase			:     int         =      self.patch_size**2
        self.parent.assertEqual(result.logits.shape  ,     (self.batch_size, num_patches, expected_num_channels)		)







 def      _lowerCamelCase       (      self	:Dict		)	->				Optional[int]:
        __UpperCamelCase			:     int         =      self.prepare_config_and_inputs()
        ((__UpperCamelCase)     ,		(__UpperCamelCase)     ,		(__UpperCamelCase))			:     Any         =      config_and_inputs
        __UpperCamelCase			:     List[Any]         =      {"pixel_values": pixel_values}
        return config, inputs_dict




@require_tf
class 				lowerCamelCase__							(       _a  ,		_a  ,		unittest.TestCase):




 '''simple docstring'''




 _A			=  (TFViTMAEModel, TFViTMAEForPreTraining) if is_tf_available() else ()
 _A			=  {"""feature-extraction""": TFViTMAEModel} if is_tf_available() else {}

 _A			=  False
 _A			=  False
 _A			=  False
 _A			=  False







 def      _lowerCamelCase       (      self	:str		)	->				Optional[int]:
        __UpperCamelCase			:     Dict         =      TFViTMAEModelTester(self		)
        __UpperCamelCase			:     int         =      ConfigTester(self  ,     config_class=snake_case_  ,     has_text_modality=snake_case_  ,     hidden_size=3_7		)







 def      _lowerCamelCase       (      self	:Optional[int]		)	->				Tuple:
        self.config_tester.run_common_tests()







 @unittest.skip(reason="ViTMAE does not use inputs_embeds"		)
 def      _lowerCamelCase       (      self	:Dict		)	->				Union[str, Any]:
        pass







 def      _lowerCamelCase       (      self	:str		)	->				Any:
        __UpperCamelCase     ,		__UpperCamelCase			:     Tuple         =      self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     int         =      model_class(snake_case_		)
               self.assertIsInstance(model.get_input_embeddings()  ,     (tf.keras.layers.Layer)		)
               __UpperCamelCase			:     Any         =      model.get_output_embeddings()
               self.assertTrue(x is None or isinstance(snake_case_  ,     tf.keras.layers.Layer		)		)







 def      _lowerCamelCase       (      self	:int		)	->				Tuple:
        __UpperCamelCase     ,		__UpperCamelCase			:     Dict         =      self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     Tuple         =      model_class(snake_case_		)
               __UpperCamelCase			:     Optional[int]         =      inspect.signature(model.call		)
               # signature.parameters is an OrderedDict => so arg_names order is deterministic
               __UpperCamelCase			:     Any         =      [*signature.parameters.keys()]

               __UpperCamelCase			:     int         =      ["pixel_values"]
               self.assertListEqual(arg_names[:1]  ,     snake_case_		)







 def      _lowerCamelCase       (      self	:List[Any]		)	->				str:
        __UpperCamelCase			:     int         =      self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*snake_case_		)







 def      _lowerCamelCase       (      self	:Optional[Any]		)	->				List[Any]:
        __UpperCamelCase			:     str         =      self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_pretraining(*snake_case_		)







 def      _lowerCamelCase       (      self	:List[str]		)	->				str:
        # make the mask reproducible
        np.random.seed(2		)

        __UpperCamelCase     ,		__UpperCamelCase			:     Any         =      self.model_tester.prepare_config_and_inputs_for_common()

        __UpperCamelCase			:     Optional[Any]         =      int((config.image_size // config.patch_size) ** 2		)
        __UpperCamelCase			:     Any         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     Union[str, Any]         =      model_class(snake_case_		)
               __UpperCamelCase			:     int         =      self._prepare_for_class(snake_case_  ,     snake_case_		)

               __UpperCamelCase			:     Tuple         =      model(snake_case_  ,     noise=snake_case_		)

               __UpperCamelCase			:     Any         =      copy.deepcopy(self._prepare_for_class(snake_case_  ,     snake_case_		)		)
               __UpperCamelCase			:     Optional[int]         =      model(**snake_case_  ,     noise=snake_case_		)
               __UpperCamelCase			:     Optional[Any]         =      outputs_dict[0].numpy()
               __UpperCamelCase			:     List[str]         =      outputs_keywords[0].numpy()

               self.assertLess(np.sum(np.abs(output_dict - output_keywords		)		)  ,     1E-6		)







 def      _lowerCamelCase       (      self	:Any		)	->				str:
        # make the mask reproducible
        np.random.seed(2		)

        __UpperCamelCase     ,		__UpperCamelCase			:     str         =      self.model_tester.prepare_config_and_inputs_for_common()

        __UpperCamelCase			:     str         =      int((config.image_size // config.patch_size) ** 2		)
        __UpperCamelCase			:     str         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)

        def prepare_numpy_arrays(a	:int		):
               __UpperCamelCase			:     str         =      {}
               for k, v in inputs_dict.items():
                      if tf.is_tensor(snake_case_		):
                             __UpperCamelCase			:     Dict         =      v.numpy()
                      else:
                             __UpperCamelCase			:     List[str]         =      np.array(snake_case_		)

               return inputs_np_dict

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     List[Any]         =      model_class(snake_case_		)

               __UpperCamelCase			:     Union[str, Any]         =      self._prepare_for_class(snake_case_  ,     snake_case_		)
               __UpperCamelCase			:     List[str]         =      prepare_numpy_arrays(snake_case_		)

               __UpperCamelCase			:     int         =      model(snake_case_  ,     noise=snake_case_		)
               __UpperCamelCase			:     Tuple         =      model(**snake_case_  ,     noise=snake_case_		)
               self.assert_outputs_same(snake_case_  ,     snake_case_		)







 def      _lowerCamelCase       (      self	:Union[str, Any]  ,     a	:Union[str, Any]  ,     a	:Optional[Any]  ,     a	:Tuple		)	->				Any:
        # make masks reproducible
        np.random.seed(2		)

        __UpperCamelCase			:     Tuple         =      int((tf_model.config.image_size // tf_model.config.patch_size) ** 2		)
        __UpperCamelCase			:     int         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)
        __UpperCamelCase			:     str         =      tf.constant(snake_case_		)

        # Add `noise` argument.
        # PT inputs will be prepared in `super().check_pt_tf_models()` with this added `noise` argument
        __UpperCamelCase			:     Optional[int]         =      tf_noise

        super().check_pt_tf_models(snake_case_  ,     snake_case_  ,     snake_case_		)







 def      _lowerCamelCase       (      self	:Optional[Any]		)	->				int:
        # make mask reproducible
        np.random.seed(2		)

        __UpperCamelCase     ,		__UpperCamelCase			:     Dict         =      self.model_tester.prepare_config_and_inputs_for_common()

        __UpperCamelCase			:     Any         =      {
            module_member
            for model_class in self.all_model_classes
            for module in (import_module(model_class.__module__		),)
            for module_member_name in dir(snake_case_		)
            if module_member_name.endswith("MainLayer"		)
            # This condition is required, since `modeling_tf_clip.py` has 3 classes whose names end with `MainLayer`.
            and module_member_name[: -len("MainLayer"		)] == model_class.__name__[: -len("Model"		)]
            for module_member in (getattr(snake_case_  ,     snake_case_		),)
            if isinstance(snake_case_  ,     snake_case_		)
            and tf.keras.layers.Layer in module_member.__bases__
            and getattr(snake_case_  ,     "_keras_serializable"  ,     snake_case_		)
        }

        __UpperCamelCase			:     Optional[int]         =      int((config.image_size // config.patch_size) ** 2		)
        __UpperCamelCase			:     Optional[int]         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)
        __UpperCamelCase			:     Optional[int]         =      tf.convert_to_tensor(snake_case_		)
        inputs_dict.update({"noise": noise}		)

        for main_layer_class in tf_main_layer_classes:
               __UpperCamelCase			:     Dict         =      main_layer_class(snake_case_		)

               __UpperCamelCase			:     str         =      {
                   name: tf.keras.Input(tensor.shape[1:]  ,     dtype=tensor.dtype		) for name, tensor in inputs_dict.items()
               }

               __UpperCamelCase			:     str         =      tf.keras.Model(snake_case_  ,     outputs=main_layer(snake_case_		)		)
               __UpperCamelCase			:     Dict         =      model(snake_case_		)

               with tempfile.TemporaryDirectory() as tmpdirname:
                      __UpperCamelCase			:     Optional[Any]         =      os.path.join(snake_case_  ,     "keras_model.h5"		)
                      model.save(snake_case_		)
                      __UpperCamelCase			:     Dict         =      tf.keras.models.load_model(
                          snake_case_  ,     custom_objects={main_layer_class.__name__: main_layer_class}		)
                      assert isinstance(snake_case_  ,     tf.keras.Model		)
                      __UpperCamelCase			:     str         =      model(snake_case_		)
                      self.assert_outputs_same(snake_case_  ,     snake_case_		)







 @slow
 def      _lowerCamelCase       (      self	:int		)	->				Any:
        # make mask reproducible
        np.random.seed(2		)

        __UpperCamelCase     ,		__UpperCamelCase			:     Tuple         =      self.model_tester.prepare_config_and_inputs_for_common()

        __UpperCamelCase			:     str         =      int((config.image_size // config.patch_size) ** 2		)
        __UpperCamelCase			:     Optional[Any]         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     int         =      model_class(snake_case_		)
               __UpperCamelCase			:     Optional[Any]         =      self._prepare_for_class(snake_case_  ,     snake_case_		)
               __UpperCamelCase			:     Union[str, Any]         =      model(snake_case_  ,     noise=snake_case_		)

               if model_class.__name__ == "TFViTMAEModel":
                      __UpperCamelCase			:     Optional[Any]         =      outputs.last_hidden_state.numpy()
                      __UpperCamelCase			:     Optional[int]         =      0
               else:
                      __UpperCamelCase			:     Optional[Any]         =      outputs.logits.numpy()
                      __UpperCamelCase			:     Optional[int]         =      0

               with tempfile.TemporaryDirectory() as tmpdirname:
                      model.save_pretrained(snake_case_  ,     saved_model=snake_case_		)
                      __UpperCamelCase			:     Tuple         =      model_class.from_pretrained(snake_case_		)
                      __UpperCamelCase			:     Dict         =      model(snake_case_  ,     noise=snake_case_		)

                      if model_class.__name__ == "TFViTMAEModel":
                             __UpperCamelCase			:     Dict         =      after_outputs["last_hidden_state"].numpy()
                             __UpperCamelCase			:     List[str]         =      0
                      else:
                             __UpperCamelCase			:     Any         =      after_outputs["logits"].numpy()
                             __UpperCamelCase			:     Tuple         =      0

                      __UpperCamelCase			:     List[Any]         =      np.amax(np.abs(out_a - out_a		)		)
                      self.assertLessEqual(snake_case_  ,     1E-5		)







 def      _lowerCamelCase       (      self	:List[Any]		)	->				Optional[Any]:
        # make mask reproducible
        np.random.seed(2		)

        __UpperCamelCase     ,		__UpperCamelCase			:     List[str]         =      self.model_tester.prepare_config_and_inputs_for_common()

        __UpperCamelCase			:     Tuple         =      int((config.image_size // config.patch_size) ** 2		)
        __UpperCamelCase			:     Optional[Any]         =      np.random.uniform(size=(self.model_tester.batch_size, num_patches)		)

        for model_class in self.all_model_classes:
               __UpperCamelCase			:     Optional[int]         =      model_class(snake_case_		)
               __UpperCamelCase			:     str         =      self._prepare_for_class(snake_case_  ,     snake_case_		)

               __UpperCamelCase			:     int         =      model(snake_case_  ,     noise=snake_case_		)
               __UpperCamelCase			:     Optional[Any]         =      model.get_config()
               # make sure that returned config is jsonifiable, which is required by keras
               json.dumps(snake_case_		)
               __UpperCamelCase			:     Dict         =      model_class.from_config(model.get_config()		)
               # make sure it also accepts a normal config
               __UpperCamelCase			:     Any         =      model_class.from_config(model.config		)
               __UpperCamelCase			:     Any         =      new_model(snake_case_		)  # Build model
               new_model.set_weights(model.get_weights()		)
               __UpperCamelCase			:     Union[str, Any]         =      new_model(snake_case_  ,     noise=snake_case_		)

               self.assert_outputs_same(snake_case_  ,     snake_case_		)







 @unittest.skip(
     reason="ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load\n    to get deterministic results."		)
 def      _lowerCamelCase       (      self	:Tuple		)	->				Optional[int]:
        pass







 @unittest.skip(reason="ViTMAE returns a random mask + ids_restore in each forward pass. See test_save_load"		)
 def      _lowerCamelCase       (      self	:List[Any]		)	->				List[Any]:
        pass







 @slow
 def      _lowerCamelCase       (      self	:Any		)	->				Optional[int]:
        __UpperCamelCase			:     Union[str, Any]         =      TFViTMAEModel.from_pretrained("google/vit-base-patch16-224"		)
        self.assertIsNotNone(snake_case_		)




def 			_SCREAMING_SNAKE_CASE      (	)      ->					Optional[Any]:






       '''simple docstring'''





       __UpperCamelCase			:     str         =      Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png")
       return image




@require_tf
@require_vision
class 				lowerCamelCase__							(       unittest.TestCase):




 '''simple docstring'''




 @cached_property
 def      _lowerCamelCase       (      self	:Optional[int]		)	->				int:
        return ViTImageProcessor.from_pretrained("facebook/vit-mae-base"		) if is_vision_available() else None







 @slow
 def      _lowerCamelCase       (      self	:Optional[Any]		)	->				Dict:
        # make random mask reproducible across the PT and TF model
        np.random.seed(2		)

        __UpperCamelCase			:     Union[str, Any]         =      TFViTMAEForPreTraining.from_pretrained("facebook/vit-mae-base"		)

        __UpperCamelCase			:     str         =      self.default_image_processor
        __UpperCamelCase			:     Union[str, Any]         =      prepare_img()
        __UpperCamelCase			:     str         =      image_processor(images=snake_case_  ,     return_tensors="tf"		)

        # prepare a noise vector that will be also used for testing the TF model
        # (this way we can ensure that the PT and TF models operate on the same inputs)
        __UpperCamelCase			:     Tuple         =      ViTMAEConfig()
        __UpperCamelCase			:     Optional[Any]         =      int((vit_mae_config.image_size // vit_mae_config.patch_size) ** 2		)
        __UpperCamelCase			:     Dict         =      np.random.uniform(size=(1, num_patches)		)

        # forward pass
        __UpperCamelCase			:     Tuple         =      model(**snake_case_  ,     noise=snake_case_		)

        # verify the logits
        __UpperCamelCase			:     List[str]         =      tf.convert_to_tensor([1, 1_9_6, 7_6_8]		)
        self.assertEqual(outputs.logits.shape  ,     snake_case_		)

        __UpperCamelCase			:     Optional[Any]         =      tf.convert_to_tensor(
            [[-0.0548, -1.7023, -0.9325], [0.3721, -0.5670, -0.2233], [0.8235, -1.3878, -0.3524]]		)

        tf.debugging.assert_near(outputs.logits[0, :3, :3]  ,     snake_case_  ,     atol=1E-4		)

from __future__ import annotations

import time
from collections.abc import Sequence
from random import randint

from matplotlib import pyplot as plt




def 			_SCREAMING_SNAKE_CASE      (	_lowerCamelCase				:    Sequence[float]		,						_lowerCamelCase				:    int		,						_lowerCamelCase				:    int)      ->					tuple[int | None, int | None, float]:






							'''simple docstring'''





							if not arr:
														return None, None, 0
							if low == high:
														return low, high, arr[low]

							__UpperCamelCase			:     Tuple         =      (low + high) // 2
							__UpperCamelCase     ,		__UpperCamelCase     ,		__UpperCamelCase			:     Dict         =      max_subarray(_lowerCamelCase		,						_lowerCamelCase		,						_lowerCamelCase)
							__UpperCamelCase     ,		__UpperCamelCase     ,		__UpperCamelCase			:     Optional[int]         =      max_subarray(_lowerCamelCase		,						mid + 1		,						_lowerCamelCase)
							__UpperCamelCase     ,		__UpperCamelCase     ,		__UpperCamelCase			:     Dict         =      max_cross_sum(_lowerCamelCase		,						_lowerCamelCase		,						_lowerCamelCase		,						_lowerCamelCase)
							if left_sum >= right_sum and left_sum >= cross_sum:
														return left_low, left_high, left_sum
							elif right_sum >= left_sum and right_sum >= cross_sum:
														return right_low, right_high, right_sum
							return cross_left, cross_right, cross_sum




def 			_SCREAMING_SNAKE_CASE      (	_lowerCamelCase				:    Sequence[float]		,						_lowerCamelCase				:    int		,						_lowerCamelCase				:    int		,						_lowerCamelCase				:    int)      ->					tuple[int, int, float]:






							'''simple docstring'''





							__UpperCamelCase     ,		__UpperCamelCase			:     Union[str, Any]         =      float("-inf"), -1
							__UpperCamelCase     ,		__UpperCamelCase			:     Optional[int]         =      float("-inf"), -1

							__UpperCamelCase			:     int | float         =      0
							for i in range(_lowerCamelCase		,						low - 1		,						-1):
														summ += arr[i]
														if summ > left_sum:
																					__UpperCamelCase			:     Tuple         =      summ
																					__UpperCamelCase			:     Optional[int]         =      i

							__UpperCamelCase			:     Union[str, Any]         =      0
							for i in range(mid + 1		,						high + 1):
														summ += arr[i]
														if summ > right_sum:
																					__UpperCamelCase			:     Union[str, Any]         =      summ
																					__UpperCamelCase			:     Optional[int]         =      i

							return max_left, max_right, (left_sum + right_sum)




def 			_SCREAMING_SNAKE_CASE      (	_lowerCamelCase				:    int)      ->					float:






							'''simple docstring'''





							__UpperCamelCase			:     Tuple         =      [randint(1		,						_lowerCamelCase) for _ in range(_lowerCamelCase)]
							__UpperCamelCase			:     Optional[Any]         =      time.time()
							max_subarray(_lowerCamelCase		,						0		,						input_size - 1)
							__UpperCamelCase			:     Any         =      time.time()
							return end - start




def 			_SCREAMING_SNAKE_CASE      (	)      ->					None:






							'''simple docstring'''





							__UpperCamelCase			:     Dict         =      [10, 100, 1_000, 10_000, 50_000, 100_000, 200_000, 300_000, 400_000, 500_000]
							__UpperCamelCase			:     Union[str, Any]         =      [time_max_subarray(_lowerCamelCase) for input_size in input_sizes]
							print("No of Inputs\t\tTime Taken")
							for input_size, runtime in zip(_lowerCamelCase		,						_lowerCamelCase):
														print(_lowerCamelCase		,						"\t\t"		,						_lowerCamelCase)
							plt.plot(_lowerCamelCase		,						_lowerCamelCase)
							plt.xlabel("Number of Inputs")
							plt.ylabel("Time taken in seconds")
							plt.show()


if __name__ == "__main__":
		from doctest import testmod

		testmod()