


import inspect
import unittest

from transformers import ConvNextVaConfig
from transformers.models.auto import get_values
from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

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


if is_torch_available():
				import torch

				from transformers import ConvNextVaBackbone, ConvNextVaForImageClassification, ConvNextVaModel
				from transformers.models.convnextva.modeling_convnextva import CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
				from PIL import Image

				from transformers import AutoImageProcessor







class 	__lowercase    :





							"""simple docstring"""







							def __init__(      self			,						lowerCAmelCase__			,						lowerCAmelCase__=1_3			,						lowerCAmelCase__=3_2			,						lowerCAmelCase__=3			,						lowerCAmelCase__=4			,						lowerCAmelCase__=[1_0, 2_0, 3_0, 4_0]			,						lowerCAmelCase__=[2, 2, 3, 2]			,						lowerCAmelCase__=True			,						lowerCAmelCase__=True			,						lowerCAmelCase__=3_7			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=1_0			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=["stage2", "stage3", "stage4"]			,						lowerCAmelCase__=[2, 3, 4]			,						lowerCAmelCase__=None			,						):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Tuple					=					parent
										SCREAMING_SNAKE_CASE_		:     str					=					batch_size
										SCREAMING_SNAKE_CASE_		:     List[str]					=					image_size
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					num_channels
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					num_stages
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					hidden_sizes
										SCREAMING_SNAKE_CASE_		:     str					=					depths
										SCREAMING_SNAKE_CASE_		:     str					=					is_training
										SCREAMING_SNAKE_CASE_		:     Any					=					use_labels
										SCREAMING_SNAKE_CASE_		:     Dict					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     str					=					num_labels
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     int					=					out_features
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					out_indices
										SCREAMING_SNAKE_CASE_		:     int					=					scope






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Dict					=					floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]       )

										SCREAMING_SNAKE_CASE_		:     Any					=					None
										if self.use_labels:
													SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					ids_tensor([self.batch_size]			,						self.num_labels       )

										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.get_config()

										return config, pixel_values, labels






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										return ConvNextVaConfig(
										    num_channels=self.num_channels			,						hidden_sizes=self.hidden_sizes			,						depths=self.depths			,						num_stages=self.num_stages			,						hidden_act=self.hidden_act			,						is_decoder=_lowerCamelCase			,						initializer_range=self.initializer_range			,						out_features=self.out_features			,						out_indices=self.out_indices			,						num_labels=self.num_labels			,						)






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Tuple					=					ConvNextVaModel(config=_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					model(_lowerCamelCase       )
										# expected last hidden states: B, C, H // 32, W // 32
										self.parent.assertEqual(
										    result.last_hidden_state.shape			,						(self.batch_size, self.hidden_sizes[-1], self.image_size // 3_2, self.image_size // 3_2)			,						)






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					ConvNextVaForImageClassification(_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     List[str]					=					model(_lowerCamelCase			,						labels=_lowerCamelCase       )
										self.parent.assertEqual(result.logits.shape			,						(self.batch_size, self.num_labels)       )






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					ConvNextVaBackbone(config=_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Dict					=					model(_lowerCamelCase       )

										# verify hidden states
										self.parent.assertEqual(len(result.feature_maps       )			,						len(config.out_features       )       )
										self.parent.assertListEqual(list(result.feature_maps[0].shape       )			,						[self.batch_size, self.hidden_sizes[1], 4, 4]       )

										# verify channels
										self.parent.assertEqual(len(model.channels       )			,						len(config.out_features       )       )
										self.parent.assertListEqual(model.channels			,						config.hidden_sizes[1:]       )

										# verify backbone works with out_features=None
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					None
										SCREAMING_SNAKE_CASE_		:     str					=					ConvNextVaBackbone(config=_lowerCamelCase       )
										model.to(_lowerCamelCase       )
										model.eval()
										SCREAMING_SNAKE_CASE_		:     Any					=					model(_lowerCamelCase       )

										# verify feature maps
										self.parent.assertEqual(len(result.feature_maps       )			,						1       )
										self.parent.assertListEqual(list(result.feature_maps[0].shape       )			,						[self.batch_size, self.hidden_sizes[-1], 1, 1]       )

										# verify channels
										self.parent.assertEqual(len(model.channels       )			,						1       )
										self.parent.assertListEqual(model.channels			,						[config.hidden_sizes[-1]]       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					self.prepare_config_and_inputs()
										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[Any]					=					config_and_inputs
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					{'pixel_values': pixel_values}
										return config, inputs_dict






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     int					=					self.prepare_config_and_inputs()
										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     str					=					config_and_inputs
										SCREAMING_SNAKE_CASE_		:     Dict					=					{'pixel_values': pixel_values, 'labels': labels}
										return config, inputs_dict







@require_torch
class 	__lowercase    (__lowerCAmelCase	,       __lowerCAmelCase	,       unittest.TestCase  ):





							"""simple docstring"""







							_UpperCAmelCase      =						(
							    (
							        ConvNextVaModel,
							        ConvNextVaForImageClassification,
							        ConvNextVaBackbone,
							    )
							    if is_torch_available()
							    else ()
							)
							_UpperCAmelCase      =						(
							    {'''feature-extraction''': ConvNextVaModel, '''image-classification''': ConvNextVaForImageClassification}
							    if is_torch_available()
							    else {}
							)

							_UpperCAmelCase      =						False
							_UpperCAmelCase      =						False
							_UpperCAmelCase      =						False
							_UpperCAmelCase      =						False
							_UpperCAmelCase      =						False






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					ConvNextVaModelTester(self       )
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					ConfigTester(self			,						config_class=_lowerCamelCase			,						has_text_modality=_lowerCamelCase			,						hidden_size=3_7       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										self.create_and_test_config_common_properties()
										self.config_tester.create_and_test_config_to_json_string()
										self.config_tester.create_and_test_config_to_json_file()
										self.config_tester.create_and_test_config_from_and_save_pretrained()
										self.config_tester.create_and_test_config_with_num_labels()
										self.config_tester.check_config_can_be_init_without_params()
										self.config_tester.check_config_arguments_init()






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										return






							@unittest.skip(reason='ConvNextV2 does not use inputs_embeds'       )
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										pass






							@unittest.skip(reason='ConvNextV2 does not support input and output embeddings'       )
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										pass






							@unittest.skip(reason='ConvNextV2 does not use feedforward chunking'       )
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										pass






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										if not self.model_tester.is_training:
													return

										for model_class in self.all_model_classes:
													SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[Any]					=					self.model_tester.prepare_config_and_inputs_with_labels()
													SCREAMING_SNAKE_CASE_		:     int					=					True

													if model_class.__name__ in [
													    *get_values(_lowerCamelCase       ),
													    *get_values(_lowerCamelCase       ),
													]:
																continue

													SCREAMING_SNAKE_CASE_		:     List[str]					=					model_class(_lowerCamelCase       )
													model.to(_lowerCamelCase       )
													model.train()
													SCREAMING_SNAKE_CASE_		:     int					=					self._prepare_for_class(_lowerCamelCase			,						_lowerCamelCase			,						return_labels=_lowerCamelCase       )
													SCREAMING_SNAKE_CASE_		:     List[str]					=					model(**_lowerCamelCase       ).loss
													loss.backward()






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										if not self.model_tester.is_training:
													return

										for model_class in self.all_model_classes:
													SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					self.model_tester.prepare_config_and_inputs_with_labels()
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					False
													SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					True

													if (
													    model_class.__name__
													    in [*get_values(_lowerCamelCase       ), *get_values(_lowerCamelCase       )]
													    or not model_class.supports_gradient_checkpointing
													):
																continue

													SCREAMING_SNAKE_CASE_		:     Any					=					model_class(_lowerCamelCase       )
													model.to(_lowerCamelCase       )
													model.gradient_checkpointing_enable()
													model.train()
													SCREAMING_SNAKE_CASE_		:     List[str]					=					self._prepare_for_class(_lowerCamelCase			,						_lowerCamelCase			,						return_labels=_lowerCamelCase       )
													SCREAMING_SNAKE_CASE_		:     List[str]					=					model(**_lowerCamelCase       ).loss
													loss.backward()






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




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

										for model_class in self.all_model_classes:
													SCREAMING_SNAKE_CASE_		:     List[Any]					=					model_class(_lowerCamelCase       )
													SCREAMING_SNAKE_CASE_		:     List[Any]					=					inspect.signature(model.forward       )
													# signature.parameters is an OrderedDict => so arg_names order is deterministic
													SCREAMING_SNAKE_CASE_		:     int					=					[*signature.parameters.keys()]

													SCREAMING_SNAKE_CASE_		:     List[Any]					=					['pixel_values']
													self.assertListEqual(arg_names[:1]			,						_lowerCamelCase       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     List[Any]					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(*_lowerCamelCase       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										def check_hidden_states_output(lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):
													SCREAMING_SNAKE_CASE_		:     List[Any]					=					model_class(_lowerCamelCase       )
													model.to(_lowerCamelCase       )
													model.eval()

													with torch.no_grad():
																SCREAMING_SNAKE_CASE_		:     Tuple					=					model(**self._prepare_for_class(_lowerCamelCase			,						_lowerCamelCase       )       )

													SCREAMING_SNAKE_CASE_		:     str					=					outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.model_tester.num_stages
													self.assertEqual(len(_lowerCamelCase       )			,						expected_num_stages + 1       )

													# ConvNextV2's feature maps are of shape (batch_size, num_channels, height, width)
													self.assertListEqual(
													    list(hidden_states[0].shape[-2:]       )			,						[self.model_tester.image_size // 4, self.model_tester.image_size // 4]			,						)

										SCREAMING_SNAKE_CASE_		,      SCREAMING_SNAKE_CASE_		:     List[Any]					=					self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
													SCREAMING_SNAKE_CASE_		:     List[str]					=					True
													check_hidden_states_output(_lowerCamelCase			,						_lowerCamelCase			,						_lowerCamelCase       )

													# check that output_hidden_states also work using config
													del inputs_dict["output_hidden_states"]
													SCREAMING_SNAKE_CASE_		:     str					=					True

													check_hidden_states_output(_lowerCamelCase			,						_lowerCamelCase			,						_lowerCamelCase       )






							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     int					=					self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_for_image_classification(*_lowerCamelCase       )






							@slow
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										for model_name in CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
													SCREAMING_SNAKE_CASE_		:     Dict					=					ConvNextVaModel.from_pretrained(_lowerCamelCase       )
													self.assertIsNotNone(_lowerCamelCase       )







def 						a__			(				):
			SCREAMING_SNAKE_CASE_		:     Tuple					=					Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'				)
			return image







@require_torch
@require_vision
class 	__lowercase    (unittest.TestCase  ):





							"""simple docstring"""







							@cached_property
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										return AutoImageProcessor.from_pretrained('facebook/convnextv2-tiny-1k-224'       ) if is_vision_available() else None






							@slow
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Dict					=					ConvNextVaForImageClassification.from_pretrained('facebook/convnextv2-tiny-1k-224'       ).to(_lowerCamelCase       )

										SCREAMING_SNAKE_CASE_		:     Tuple					=					self.default_image_processor
										SCREAMING_SNAKE_CASE_		:     Dict					=					prepare_img()
										SCREAMING_SNAKE_CASE_		:     Dict					=					preprocessor(images=_lowerCamelCase			,						return_tensors='pt'       ).to(_lowerCamelCase       )

										# forward pass
										with torch.no_grad():
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					model(**_lowerCamelCase       )

										# verify the logits
										SCREAMING_SNAKE_CASE_		:     Tuple					=					torch.Size((1, 1_0_0_0)       )
										self.assertEqual(outputs.logits.shape			,						_lowerCamelCase       )

										SCREAMING_SNAKE_CASE_		:     Any					=					torch.tensor([0.9_996, 0.1_966, -0.4_386]       ).to(_lowerCamelCase       )
										self.assertTrue(torch.allclose(outputs.logits[0, :3]			,						_lowerCamelCase			,						atol=1E-4       )       )






"""simple docstring"""


from __future__ import annotations

import math





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase							)				->   list:




						'''simple docstring'''



						if len(__lowerCAmelCase							) != 2 or len(a[0]							) != 2 or len(__lowerCAmelCase							) != 2 or len(b[0]							) != 2:
												raise Exception("Matrices are not 2x2"							)
						lowerCamelCase__   =[
						    [a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]],
						    [a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]],
						]
						return new_matrix





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase							)				->   Dict:




						'''simple docstring'''



						return [
						    [matrix_a[row][col] + matrix_b[row][col] for col in range(len(matrix_a[row]							)							)]
						    for row in range(len(__lowerCAmelCase							)							)
						]





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase							)				->   List[Any]:




						'''simple docstring'''



						return [
						    [matrix_a[row][col] - matrix_b[row][col] for col in range(len(matrix_a[row]							)							)]
						    for row in range(len(__lowerCAmelCase							)							)
						]





def      lowerCamelCase_					(   __lowerCAmelCase							)				->   tuple[list, list, list, list]:




						'''simple docstring'''



						if len(__lowerCAmelCase							) % 2 != 0 or len(a[0]							) % 2 != 0:
												raise Exception("Odd matrices are not supported!"							)

						lowerCamelCase__   =len(__lowerCAmelCase							)
						lowerCamelCase__   =matrix_length // 2

						lowerCamelCase__   =[[a[i][j] for j in range(__lowerCAmelCase  ,       __lowerCAmelCase							)] for i in range(__lowerCAmelCase							)]
						lowerCamelCase__   =[
						    [a[i][j] for j in range(__lowerCAmelCase  ,       __lowerCAmelCase							)] for i in range(__lowerCAmelCase  ,       __lowerCAmelCase							)
						]

						lowerCamelCase__   =[[a[i][j] for j in range(__lowerCAmelCase							)] for i in range(__lowerCAmelCase							)]
						lowerCamelCase__   =[[a[i][j] for j in range(__lowerCAmelCase							)] for i in range(__lowerCAmelCase  ,       __lowerCAmelCase							)]

						return top_left, top_right, bot_left, bot_right





def      lowerCamelCase_					(   __lowerCAmelCase							)				->   tuple[int, int]:




						'''simple docstring'''



						return len(__lowerCAmelCase							), len(matrix[0]							)





def      lowerCamelCase_					(   __lowerCAmelCase							)				->   None:




						'''simple docstring'''



						print("\n".join(str(__lowerCAmelCase							) for line in matrix							)							)





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase							)				->   list:




						'''simple docstring'''



						if matrix_dimensions(__lowerCAmelCase							) == (2, 2):
												return default_matrix_multiplication(__lowerCAmelCase  ,       __lowerCAmelCase							)

						lowerCamelCase__   , lowerCamelCase__   , lowerCamelCase__   , lowerCamelCase__   =split_matrix(__lowerCAmelCase							)
						lowerCamelCase__   , lowerCamelCase__   , lowerCamelCase__   , lowerCamelCase__   =split_matrix(__lowerCAmelCase							)

						lowerCamelCase__   =actual_strassen(__lowerCAmelCase  ,       matrix_subtraction(__lowerCAmelCase  ,       __lowerCAmelCase							)							)
						lowerCamelCase__   =actual_strassen(matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)
						lowerCamelCase__   =actual_strassen(matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)
						lowerCamelCase__   =actual_strassen(__lowerCAmelCase  ,       matrix_subtraction(__lowerCAmelCase  ,       __lowerCAmelCase							)							)
						lowerCamelCase__   =actual_strassen(matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)							)
						lowerCamelCase__   =actual_strassen(matrix_subtraction(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)							)
						lowerCamelCase__   =actual_strassen(matrix_subtraction(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)							)

						lowerCamelCase__   =matrix_addition(matrix_subtraction(matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)
						lowerCamelCase__   =matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)
						lowerCamelCase__   =matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)
						lowerCamelCase__   =matrix_subtraction(matrix_subtraction(matrix_addition(__lowerCAmelCase  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)  ,       __lowerCAmelCase							)

						# construct the new matrix from our 4 quadrants
						lowerCamelCase__   =[]
						for i in range(len(__lowerCAmelCase							)							):
												new_matrix.append(top_left[i] + top_right[i]							)
						for i in range(len(__lowerCAmelCase							)							):
												new_matrix.append(bot_left[i] + bot_right[i]							)
						return new_matrix





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase							)				->   list:




						'''simple docstring'''



						if matrix_dimensions(__lowerCAmelCase							)[1] != matrix_dimensions(__lowerCAmelCase							)[0]:
												lowerCamelCase__   =(
												    "Unable to multiply these matrices, please check the dimensions.\n"
												    F'''Matrix A: {matrixa}\n'''
												    F'''Matrix B: {matrixa}'''
												)
												raise Exception(__lowerCAmelCase							)
						lowerCamelCase__   =matrix_dimensions(__lowerCAmelCase							)
						lowerCamelCase__   =matrix_dimensions(__lowerCAmelCase							)

						if dimensiona[0] == dimensiona[1] and dimensiona[0] == dimensiona[1]:
												return [matrixa, matrixa]

						lowerCamelCase__   =max(*__lowerCAmelCase  ,       *__lowerCAmelCase							)
						lowerCamelCase__   =int(math.pow(2  ,       math.ceil(math.loga(__lowerCAmelCase							)							)							)							)
						lowerCamelCase__   =matrixa
						lowerCamelCase__   =matrixa

						# Adding zeros to the matrices so that the arrays dimensions are the same and also
						# power of 2
						for i in range(0  ,       __lowerCAmelCase							):
												if i < dimensiona[0]:
																		for _ in range(dimensiona[1]  ,       __lowerCAmelCase							):
																								new_matrixa[i].append(0							)
												else:
																		new_matrixa.append([0] * maxim							)
												if i < dimensiona[0]:
																		for _ in range(dimensiona[1]  ,       __lowerCAmelCase							):
																								new_matrixa[i].append(0							)
												else:
																		new_matrixa.append([0] * maxim							)

						lowerCamelCase__   =actual_strassen(__lowerCAmelCase  ,       __lowerCAmelCase							)

						# Removing the additional zeros
						for i in range(0  ,       __lowerCAmelCase							):
												if i < dimensiona[0]:
																		for _ in range(dimensiona[1]  ,       __lowerCAmelCase							):
																								final_matrix[i].pop()
												else:
																		final_matrix.pop()
						return final_matrix


if __name__ == "__main__":
	a				=[
	    [2, 3, 4, 5],
	    [6, 4, 3, 1],
	    [2, 3, 6, 7],
	    [3, 1, 2, 4],
	    [2, 3, 4, 5],
	    [6, 4, 3, 1],
	    [2, 3, 6, 7],
	    [3, 1, 2, 4],
	    [2, 3, 4, 5],
	    [6, 2, 3, 1],
	]
	a				=[[0, 2, 1, 1], [16, 2, 3, 3], [2, 2, 7, 7], [13, 11, 22, 4]]
	print(strassen(matrixa, matrixa))


