'''simple docstring'''

import math
import os
import unittest

from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import (
      MODEL_FOR_PRETRAINING_MAPPING,
      MegatronBertForCausalLM,
      MegatronBertForMaskedLM,
      MegatronBertForMultipleChoice,
      MegatronBertForNextSentencePrediction,
      MegatronBertForPreTraining,
      MegatronBertForQuestionAnswering,
      MegatronBertForSequenceClassification,
      MegatronBertForTokenClassification,
      MegatronBertModel,
  )



class 			UpperCAmelCase  :





       '''simple docstring'''



       def __init__(						self	,   __lowerCAmelCase	,   __lowerCAmelCase=13	,   __lowerCAmelCase=7	,   __lowerCAmelCase=True	,   __lowerCAmelCase=True	,   __lowerCAmelCase=True	,   __lowerCAmelCase=True	,   __lowerCAmelCase=99	,   __lowerCAmelCase=64	,   __lowerCAmelCase=32	,   __lowerCAmelCase=5	,   __lowerCAmelCase=4	,   __lowerCAmelCase=37	,   __lowerCAmelCase="gelu"	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=512	,   __lowerCAmelCase=16	,   __lowerCAmelCase=2	,   __lowerCAmelCase=0.0_2	,   __lowerCAmelCase=3	,   __lowerCAmelCase=4	,   __lowerCAmelCase=None	,   )  ->  Tuple:
        lowercase__				:    List[str]  =					parent
        lowercase__				:    Union[str, Any]  =					batch_size
        lowercase__				:    Union[str, Any]  =					seq_length
        lowercase__				:    List[Any]  =					is_training
        lowercase__				:    Tuple  =					use_input_mask
        lowercase__				:    List[Any]  =					use_token_type_ids
        lowercase__				:    Optional[Any]  =					use_labels
        lowercase__				:    int  =					vocab_size
        lowercase__				:    Optional[Any]  =					hidden_size
        lowercase__				:    Tuple  =					embedding_size
        lowercase__				:    Optional[Any]  =					num_hidden_layers
        lowercase__				:    str  =					num_attention_heads
        lowercase__				:    Optional[Any]  =					intermediate_size
        lowercase__				:    Dict  =					hidden_act
        lowercase__				:    Optional[Any]  =					hidden_dropout_prob
        lowercase__				:    List[str]  =					attention_probs_dropout_prob
        lowercase__				:    Optional[int]  =					max_position_embeddings
        lowercase__				:    str  =					type_vocab_size
        lowercase__				:    List[Any]  =					type_sequence_label_size
        lowercase__				:    List[Any]  =					initializer_range
        lowercase__				:    Tuple  =					num_labels
        lowercase__				:    Optional[Any]  =					num_choices
        lowercase__				:    int  =					scope

       def _lowerCAmelCase(						self )  ->  Union[str, Any]:
        lowercase__				:    List[str]  =					ids_tensor([self.batch_size, self.seq_length]	,   self.vocab_size )

        lowercase__				:    int  =					None
        if self.use_input_mask:
         lowercase__				:    Dict  =					random_attention_mask([self.batch_size, self.seq_length] )

        lowercase__				:    List[Any]  =					None
        if self.use_token_type_ids:
         lowercase__				:    str  =					ids_tensor([self.batch_size, self.seq_length]	,   self.type_vocab_size )

        lowercase__				:    int  =					None
        lowercase__				:    List[Any]  =					None
        lowercase__				:    List[Any]  =					None
        if self.use_labels:
         lowercase__				:    Optional[Any]  =					ids_tensor([self.batch_size]	,   self.type_sequence_label_size )
         lowercase__				:    Optional[Any]  =					ids_tensor([self.batch_size, self.seq_length]	,   self.num_labels )
         lowercase__				:    Any  =					ids_tensor([self.batch_size]	,   self.num_choices )

        lowercase__				:    Dict  =					self.get_config()

        return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels

       def _lowerCAmelCase(						self )  ->  List[str]:
        return MegatronBertConfig(
            vocab_size=self.vocab_size	,   hidden_size=self.hidden_size	,   num_hidden_layers=self.num_hidden_layers	,   num_attention_heads=self.num_attention_heads	,   intermediate_size=self.intermediate_size	,   embedding_size=self.embedding_size	,   hidden_act=self.hidden_act	,   hidden_dropout_prob=self.hidden_dropout_prob	,   attention_probs_dropout_prob=self.attention_probs_dropout_prob	,   max_position_embeddings=self.max_position_embeddings	,   type_vocab_size=self.type_vocab_size	,   is_decoder=__lowerCAmelCase	,   initializer_range=self.initializer_range	,   )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  Tuple:
        lowercase__				:    int  =					MegatronBertModel(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    str  =					model(__lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase )
        lowercase__				:    Dict  =					model(__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase )
        lowercase__				:    Any  =					model(__lowerCAmelCase )

        self.parent.assertEqual(result.last_hidden_state.shape	,   (self.batch_size, self.seq_length, self.hidden_size) )
        self.parent.assertEqual(result.pooler_output.shape	,   (self.batch_size, self.hidden_size) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  Union[str, Any]:
        lowercase__				:    Optional[int]  =					MegatronBertForMaskedLM(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Union[str, Any]  =					model(__lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, self.seq_length, self.vocab_size) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  Optional[int]:
        lowercase__				:    int  =					MegatronBertForCausalLM(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    List[Any]  =					model(__lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, self.seq_length, self.vocab_size) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  str:
        lowercase__				:    Any  =					MegatronBertForNextSentencePrediction(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Any  =					model(
            __lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase	,   )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, 2) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  int:
        lowercase__				:    Optional[int]  =					MegatronBertForPreTraining(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    List[Any]  =					model(
            __lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase	,   next_sentence_label=__lowerCAmelCase	,   )
        self.parent.assertEqual(result.prediction_logits.shape	,   (self.batch_size, self.seq_length, self.vocab_size) )
        self.parent.assertEqual(result.seq_relationship_logits.shape	,   (self.batch_size, 2) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  Any:
        lowercase__				:    Any  =					MegatronBertForQuestionAnswering(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Union[str, Any]  =					model(
            __lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   start_positions=__lowerCAmelCase	,   end_positions=__lowerCAmelCase	,   )
        self.parent.assertEqual(result.start_logits.shape	,   (self.batch_size, self.seq_length) )
        self.parent.assertEqual(result.end_logits.shape	,   (self.batch_size, self.seq_length) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  str:
        lowercase__				:    Optional[Any]  =					self.num_labels
        lowercase__				:    Tuple  =					MegatronBertForSequenceClassification(__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Optional[int]  =					model(__lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, self.num_labels) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  Dict:
        lowercase__				:    List[str]  =					self.num_labels
        lowercase__				:    str  =					MegatronBertForTokenClassification(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Optional[Any]  =					model(__lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, self.seq_length, self.num_labels) )

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )  ->  int:
        lowercase__				:    List[Any]  =					self.num_choices
        lowercase__				:    Tuple  =					MegatronBertForMultipleChoice(config=__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.eval()
        lowercase__				:    Dict  =					input_ids.unsqueeze(1 ).expand(-1	,   self.num_choices	,   -1 ).contiguous()
        lowercase__				:    Dict  =					token_type_ids.unsqueeze(1 ).expand(-1	,   self.num_choices	,   -1 ).contiguous()
        lowercase__				:    Any  =					input_mask.unsqueeze(1 ).expand(-1	,   self.num_choices	,   -1 ).contiguous()
        lowercase__				:    str  =					model(
            __lowerCAmelCase	,   attention_mask=__lowerCAmelCase	,   token_type_ids=__lowerCAmelCase	,   labels=__lowerCAmelCase	,   )
        self.parent.assertEqual(result.logits.shape	,   (self.batch_size, self.num_choices) )


       def _lowerCAmelCase(						self )  ->  Tuple:
        lowercase__				:    List[Any]  =					self.prepare_config_and_inputs()
        (
            (
            lowercase__
        ) ,							(
            lowercase__
        ) ,							(
            lowercase__
        ) ,							(
            lowercase__
        ) ,							(
            lowercase__
        ) ,							(
            lowercase__
        ) ,							(
            lowercase__
        ) ,							
        )				:    List[str]  =					config_and_inputs
        lowercase__				:    Union[str, Any]  =					{'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
        return config, inputs_dict



@require_torch
class 			UpperCAmelCase  (						a__    ,						a__    ,						unittest.TestCase					):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE							=    (
           (
               MegatronBertModel,
               MegatronBertForMaskedLM,
               MegatronBertForCausalLM,
               MegatronBertForMultipleChoice,
               MegatronBertForNextSentencePrediction,
               MegatronBertForPreTraining,
               MegatronBertForQuestionAnswering,
               MegatronBertForSequenceClassification,
               MegatronBertForTokenClassification,
           )
           if is_torch_available()
           else ()
       )
       SCREAMING_SNAKE_CASE							=    (
           {
               "feature-extraction": MegatronBertModel,
               "fill-mask": MegatronBertForMaskedLM,
               "question-answering": MegatronBertForQuestionAnswering,
               "text-classification": MegatronBertForSequenceClassification,
               "text-generation": MegatronBertForCausalLM,
               "token-classification": MegatronBertForTokenClassification,
               "zero-shot": MegatronBertForSequenceClassification,
           }
           if is_torch_available()
           else {}
       )
       SCREAMING_SNAKE_CASE							=    True
       # test_resize_embeddings = False
       SCREAMING_SNAKE_CASE							=    False

       def _lowerCAmelCase(						self	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase=False )  ->  Union[str, Any]:
        lowercase__				:    Dict  =					super()._prepare_for_class(__lowerCAmelCase	,   __lowerCAmelCase	,   return_labels=__lowerCAmelCase )

        if return_labels:
         if model_class in get_values(__lowerCAmelCase ):
          lowercase__				:    List[Any]  =					torch.zeros(
              (self.model_tester.batch_size, self.model_tester.seq_length)	,   dtype=torch.long	,   device=__lowerCAmelCase )
          lowercase__				:    Any  =					torch.zeros(
              self.model_tester.batch_size	,   dtype=torch.long	,   device=__lowerCAmelCase )
        return inputs_dict

       def _lowerCAmelCase(						self )  ->  int:
        lowercase__				:    str  =					MegatronBertModelTester(self )
        lowercase__				:    Union[str, Any]  =					ConfigTester(self	,   config_class=__lowerCAmelCase	,   hidden_size=37 )

       def _lowerCAmelCase(						self )  ->  List[Any]:
        self.config_tester.run_common_tests()

       def _lowerCAmelCase(						self )  ->  List[Any]:
        lowercase__				:    Tuple  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_model(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  str:
        lowercase__				:    Any  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_masked_lm(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  str:
        lowercase__				:    Optional[int]  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  int:
        lowercase__				:    List[str]  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  Optional[Any]:
        lowercase__				:    Tuple  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_pretraining(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  Dict:
        lowercase__				:    Optional[int]  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_question_answering(*__lowerCAmelCase )

       def _lowerCAmelCase(						self )  ->  Optional[int]:
        lowercase__				:    Tuple  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*__lowerCAmelCase )


       def _lowerCAmelCase(						self )  ->  Optional[int]:
        lowercase__				:    Union[str, Any]  =					self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_megatron_bert_for_token_classification(*__lowerCAmelCase )


def 			__UpperCamelCase       (   UpperCAmelCase     ):
 return torch.tensor(
     UpperCAmelCase		,     dtype=torch.long		,     device=UpperCAmelCase		,     )


__a: Optional[Any]          =   1E-4





@require_torch
@require_sentencepiece
@require_tokenizers
class 			UpperCAmelCase  (						unittest.TestCase					):





       '''simple docstring'''



       @slow
       @unittest.skip('''Model is not available.''' )
       def _lowerCAmelCase(						self )  ->  List[Any]:
        lowercase__				:    Optional[int]  =					'''nvidia/megatron-bert-uncased-345m'''
        if "MYDIR" in os.environ:
         lowercase__				:    Optional[Any]  =					os.path.join(os.environ['''MYDIR''']	,   __lowerCAmelCase )
        lowercase__				:    int  =					MegatronBertModel.from_pretrained(__lowerCAmelCase )
        model.to(__lowerCAmelCase )
        model.half()
        lowercase__				:    Optional[int]  =					_long_tensor([[101, 7110, 1005, 1056, 2023, 11333, 17413, 1029, 102]] )
        with torch.no_grad():
         lowercase__				:    Union[str, Any]  =					model(__lowerCAmelCase )[0]
        lowercase__				:    Tuple  =					torch.Size((1, 9, 1024) )
        self.assertEqual(output.shape	,   __lowerCAmelCase )

        lowercase__				:    Dict  =					[-0.6_0_4_0, -0.2_5_1_7, -0.1_0_2_5, 0.3_4_2_0, -0.6_7_5_8, -0.0_0_1_7, -0.1_0_8_9, -0.1_9_9_0, 0.5_7_2_8]
        for ii in range(3 ):
         for jj in range(3 ):
          lowercase__				:    Tuple  =					output[0, ii, jj]
          lowercase__				:    List[Any]  =					expected[3 * ii + jj]
          lowercase__				:    Dict  =					'''ii={} jj={} a={} b={}'''.format(__lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase	,   __lowerCAmelCase )
          self.assertTrue(math.isclose(__lowerCAmelCase	,   __lowerCAmelCase	,   rel_tol=__lowerCAmelCase	,   abs_tol=__lowerCAmelCase )	,   msg=__lowerCAmelCase )


'''simple docstring'''

def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):

 def update_area_of_max_square(UpperCAmelCase		,     UpperCAmelCase     ) -> int:
  # BASE CASE
  if row >= rows or col >= cols:
   return 0

  lowercase__				:    int  =					update_area_of_max_square(UpperCAmelCase		,     col + 1     )
  lowercase__				:    Any  =					update_area_of_max_square(row + 1		,     col + 1     )
  lowercase__				:    str  =					update_area_of_max_square(row + 1		,     UpperCAmelCase     )

  if mat[row][col]:
   lowercase__				:    List[Any]  =					1 + min([right, diagonal, down]     )
   lowercase__				:    List[Any]  =					max(largest_square_area[0]		,     UpperCAmelCase     )
   return sub_problem_sol
  else:
   return 0

 lowercase__				:    Dict  =					[0]
 update_area_of_max_square(0		,     0     )
 return largest_square_area[0]
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):

 def update_area_of_max_square_using_dp_array(
     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ) -> int:
  if row >= rows or col >= cols:
   return 0
  if dp_array[row][col] != -1:
   return dp_array[row][col]

  lowercase__				:    int  =					update_area_of_max_square_using_dp_array(UpperCAmelCase		,     col + 1		,     UpperCAmelCase     )
  lowercase__				:    Optional[int]  =					update_area_of_max_square_using_dp_array(row + 1		,     col + 1		,     UpperCAmelCase     )
  lowercase__				:    Any  =					update_area_of_max_square_using_dp_array(row + 1		,     UpperCAmelCase		,     UpperCAmelCase     )

  if mat[row][col]:
   lowercase__				:    Optional[int]  =					1 + min([right, diagonal, down]     )
   lowercase__				:    Any  =					max(largest_square_area[0]		,     UpperCAmelCase     )
   lowercase__				:    int  =					sub_problem_sol
   return sub_problem_sol
  else:
   return 0

 lowercase__				:    Any  =					[0]
 lowercase__				:    List[Any]  =					[[-1] * cols for _ in range(UpperCAmelCase     )]
 update_area_of_max_square_using_dp_array(0		,     0		,     UpperCAmelCase     )

 return largest_square_area[0]
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):
 lowercase__				:    Optional[int]  =					[[0] * (cols + 1) for _ in range(rows + 1     )]
 lowercase__				:    str  =					0
 for row in range(rows - 1		,     -1		,     -1     ):
  for col in range(cols - 1		,     -1		,     -1     ):
   lowercase__				:    str  =					dp_array[row][col + 1]
   lowercase__				:    Optional[Any]  =					dp_array[row + 1][col + 1]
   lowercase__				:    str  =					dp_array[row + 1][col]

   if mat[row][col] == 1:
    lowercase__				:    Dict  =					1 + min(UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     )
    lowercase__				:    str  =					max(dp_array[row][col]		,     UpperCAmelCase     )
   else:
    lowercase__				:    Any  =					0

 return largest_square_area
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):
 lowercase__				:    List[str]  =					[0] * (cols + 1)
 lowercase__				:    str  =					[0] * (cols + 1)
 lowercase__				:    Tuple  =					0
 for row in range(rows - 1		,     -1		,     -1     ):
  for col in range(cols - 1		,     -1		,     -1     ):
   lowercase__				:    List[Any]  =					current_row[col + 1]
   lowercase__				:    Any  =					next_row[col + 1]
   lowercase__				:    Optional[Any]  =					next_row[col]

   if mat[row][col] == 1:
    lowercase__				:    List[str]  =					1 + min(UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     )
    lowercase__				:    List[str]  =					max(current_row[col]		,     UpperCAmelCase     )
   else:
    lowercase__				:    int  =					0
  lowercase__				:    int  =					current_row

 return largest_square_area


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))

