'''simple docstring'''







import collections
import inspect
import unittest

from transformers import SwinvaConfig
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, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch
		from torch import nn

		from transformers import SwinvaForImageClassification, SwinvaForMaskedImageModeling, SwinvaModel
		from transformers.models.swinva.modeling_swinva import SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
		from PIL import Image

		from transformers import AutoImageProcessor




class _SCREAMING_SNAKE_CASE:




						def __init__(    self :       Union[str, Any]							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       List[Any]=13							,							UpperCamelCase_ :       Optional[int]=32							,							UpperCamelCase_ :       str=2							,							UpperCamelCase_ :       Optional[int]=3							,							UpperCamelCase_ :       Any=16							,							UpperCamelCase_ :       Union[str, Any]=[1, 2, 1]							,							UpperCamelCase_ :       Any=[2, 2, 4]							,							UpperCamelCase_ :       List[str]=2							,							UpperCamelCase_ :       Optional[int]=2.0							,							UpperCamelCase_ :       Optional[int]=True							,							UpperCamelCase_ :       Optional[Any]=0.0							,							UpperCamelCase_ :       List[str]=0.0							,							UpperCamelCase_ :       Optional[int]=0.1							,							UpperCamelCase_ :       Optional[Any]="gelu"							,							UpperCamelCase_ :       Dict=False							,							UpperCamelCase_ :       List[Any]=True							,							UpperCamelCase_ :       Dict=0.02							,							UpperCamelCase_ :       List[Any]=1e-5							,							UpperCamelCase_ :       int=True							,							UpperCamelCase_ :       Dict=None							,							UpperCamelCase_ :       Dict=True							,							UpperCamelCase_ :       Any=10							,							UpperCamelCase_ :       Optional[Any]=8							,							)     ->				Optional[Any]:
													SCREAMING_SNAKE_CASE__     :List[str]						    = parent
													SCREAMING_SNAKE_CASE__     :Tuple						    = batch_size
													SCREAMING_SNAKE_CASE__     :Dict						    = image_size
													SCREAMING_SNAKE_CASE__     :List[Any]						    = patch_size
													SCREAMING_SNAKE_CASE__     :int						    = num_channels
													SCREAMING_SNAKE_CASE__     :str						    = embed_dim
													SCREAMING_SNAKE_CASE__     :List[Any]						    = depths
													SCREAMING_SNAKE_CASE__     :Tuple						    = num_heads
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = window_size
													SCREAMING_SNAKE_CASE__     :str						    = mlp_ratio
													SCREAMING_SNAKE_CASE__     :Any						    = qkv_bias
													SCREAMING_SNAKE_CASE__     :Tuple						    = hidden_dropout_prob
													SCREAMING_SNAKE_CASE__     :str						    = attention_probs_dropout_prob
													SCREAMING_SNAKE_CASE__     :Dict						    = drop_path_rate
													SCREAMING_SNAKE_CASE__     :Dict						    = hidden_act
													SCREAMING_SNAKE_CASE__     :Any						    = use_absolute_embeddings
													SCREAMING_SNAKE_CASE__     :Dict						    = patch_norm
													SCREAMING_SNAKE_CASE__     :int						    = layer_norm_eps
													SCREAMING_SNAKE_CASE__     :str						    = initializer_range
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = is_training
													SCREAMING_SNAKE_CASE__     :List[Any]						    = scope
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = use_labels
													SCREAMING_SNAKE_CASE__     :int						    = type_sequence_label_size
													SCREAMING_SNAKE_CASE__     :str						    = encoder_stride




						def      __lowerCamelCase       (    self :       Union[str, Any]      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :List[Any]						    = floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

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

													SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.get_config()

													return config, pixel_values, labels




						def      __lowerCamelCase       (    self :       Any      )     ->				Optional[int]:
													return SwinvaConfig(
													    image_size=self.image_size							,							patch_size=self.patch_size							,							num_channels=self.num_channels							,							embed_dim=self.embed_dim							,							depths=self.depths							,							num_heads=self.num_heads							,							window_size=self.window_size							,							mlp_ratio=self.mlp_ratio							,							qkv_bias=self.qkv_bias							,							hidden_dropout_prob=self.hidden_dropout_prob							,							attention_probs_dropout_prob=self.attention_probs_dropout_prob							,							drop_path_rate=self.drop_path_rate							,							hidden_act=self.hidden_act							,							use_absolute_embeddings=self.use_absolute_embeddings							,							path_norm=self.patch_norm							,							layer_norm_eps=self.layer_norm_eps							,							initializer_range=self.initializer_range							,							encoder_stride=self.encoder_stride							,							)




						def      __lowerCamelCase       (    self :       Optional[Any]							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       int      )     ->				str:
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = SwinvaModel(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :Dict						    = model(UpperCamelCase_      )

													SCREAMING_SNAKE_CASE__     :Optional[int]						    = ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths      ) - 1))
													SCREAMING_SNAKE_CASE__     :str						    = int(config.embed_dim * 2 ** (len(config.depths      ) - 1)      )

													self.parent.assertEqual(result.last_hidden_state.shape							,							(self.batch_size, expected_seq_len, expected_dim)      )




						def      __lowerCamelCase       (    self :       List[str]							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Tuple      )     ->				Tuple:
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = SwinvaForMaskedImageModeling(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :List[Any]						    = model(UpperCamelCase_      )
													self.parent.assertEqual(
													    result.logits.shape							,							(self.batch_size, self.num_channels, self.image_size, self.image_size)      )

													# test greyscale images
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = 1
													SCREAMING_SNAKE_CASE__     :Any						    = SwinvaForMaskedImageModeling(UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()

													SCREAMING_SNAKE_CASE__     :Any						    = floats_tensor([self.batch_size, 1, self.image_size, self.image_size]      )
													SCREAMING_SNAKE_CASE__     :List[str]						    = model(UpperCamelCase_      )
													self.parent.assertEqual(result.logits.shape							,							(self.batch_size, 1, self.image_size, self.image_size)      )




						def      __lowerCamelCase       (    self :       str							,							UpperCamelCase_ :       List[Any]							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Tuple      )     ->				List[str]:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.type_sequence_label_size
													SCREAMING_SNAKE_CASE__     :List[str]						    = SwinvaForImageClassification(UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :Dict						    = model(UpperCamelCase_							,							labels=UpperCamelCase_      )
													self.parent.assertEqual(result.logits.shape							,							(self.batch_size, self.type_sequence_label_size)      )




						def      __lowerCamelCase       (    self :       Optional[Any]      )     ->				List[str]:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.prepare_config_and_inputs()
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = config_and_inputs
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = {'pixel_values': pixel_values}
													return config, inputs_dict




@require_torch
class _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE						,						_SCREAMING_SNAKE_CASE						,						unittest.TestCase					):
						A_			:							List[str]     		= (
						    (SwinvaModel, SwinvaForImageClassification, SwinvaForMaskedImageModeling) if is_torch_available() else ()
						)
						A_			:							Dict     		= (
						    {'feature-extraction': SwinvaModel, 'image-classification': SwinvaForImageClassification}
						    if is_torch_available()
						    else {}
						)

						A_			:							Optional[int]     		= False
						A_			:							List[Any]     		= False
						A_			:							Optional[Any]     		= False
						A_			:							List[str]     		= False




						def      __lowerCamelCase       (    self :       List[Any]      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :Any						    = SwinvaModelTester(self      )
													SCREAMING_SNAKE_CASE__     :List[Any]						    = ConfigTester(self							,							config_class=UpperCamelCase_							,							embed_dim=37      )




						def      __lowerCamelCase       (    self :       Tuple      )     ->				Union[str, Any]:
													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      __lowerCamelCase       (    self :       List[str]      )     ->				Optional[int]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_model(*UpperCamelCase_      )




						@unittest.skip(reason='Got `CUDA error: misaligned address` with PyTorch 2.0.0.'      )
						def      __lowerCamelCase       (    self :       List[str]      )     ->				List[str]:
													pass




						@unittest.skip(reason='Swinv2 does not use inputs_embeds'      )
						def      __lowerCamelCase       (    self :       List[Any]      )     ->				Union[str, Any]:
													pass




						def      __lowerCamelCase       (    self :       List[Any]      )     ->				List[str]:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :int						    = self.model_tester.prepare_config_and_inputs_for_common()

													for model_class in self.all_model_classes:
																				SCREAMING_SNAKE_CASE__     :Any						    = model_class(UpperCamelCase_      )
																				self.assertIsInstance(model.get_input_embeddings()							,							(nn.Module)      )
																				SCREAMING_SNAKE_CASE__     :int						    = model.get_output_embeddings()
																				self.assertTrue(x is None or isinstance(UpperCamelCase_							,							nn.Linear      )      )




						def      __lowerCamelCase       (    self :       List[Any]      )     ->				str:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.model_tester.prepare_config_and_inputs_for_common()

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

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




						def      __lowerCamelCase       (    self :       Optional[int]      )     ->				int:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :Any						    = self.model_tester.prepare_config_and_inputs_for_common()
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = True

													for model_class in self.all_model_classes:
																				SCREAMING_SNAKE_CASE__     :str						    = True
																				SCREAMING_SNAKE_CASE__     :Dict						    = False
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = True
																				SCREAMING_SNAKE_CASE__     :List[str]						    = model_class(UpperCamelCase_      )
																				model.to(UpperCamelCase_      )
																				model.eval()
																				with torch.no_grad():
																											SCREAMING_SNAKE_CASE__     :Tuple						    = model(**self._prepare_for_class(UpperCamelCase_							,							UpperCamelCase_      )      )
																				SCREAMING_SNAKE_CASE__     :str						    = outputs.attentions
																				SCREAMING_SNAKE_CASE__     :List[Any]						    = len(self.model_tester.depths      )
																				self.assertEqual(len(UpperCamelCase_      )							,							UpperCamelCase_      )

																				# check that output_attentions also work using config
																				del inputs_dict["output_attentions"]
																				SCREAMING_SNAKE_CASE__     :Dict						    = True
																				SCREAMING_SNAKE_CASE__     :Any						    = config.window_size**2
																				SCREAMING_SNAKE_CASE__     :Dict						    = model_class(UpperCamelCase_      )
																				model.to(UpperCamelCase_      )
																				model.eval()
																				with torch.no_grad():
																											SCREAMING_SNAKE_CASE__     :Tuple						    = model(**self._prepare_for_class(UpperCamelCase_							,							UpperCamelCase_      )      )
																				SCREAMING_SNAKE_CASE__     :Dict						    = outputs.attentions
																				self.assertEqual(len(UpperCamelCase_      )							,							UpperCamelCase_      )

																				self.assertListEqual(
																				    list(attentions[0].shape[-3:]      )							,							[self.model_tester.num_heads[0], window_size_squared, window_size_squared]							,							)
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = len(UpperCamelCase_      )

																				# Check attention is always last and order is fine
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = True
																				SCREAMING_SNAKE_CASE__     :List[str]						    = True
																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = model_class(UpperCamelCase_      )
																				model.to(UpperCamelCase_      )
																				model.eval()
																				with torch.no_grad():
																											SCREAMING_SNAKE_CASE__     :List[Any]						    = model(**self._prepare_for_class(UpperCamelCase_							,							UpperCamelCase_      )      )

																				if hasattr(self.model_tester							,							'num_hidden_states_types'      ):
																											SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.num_hidden_states_types
																				else:
																											# also another +1 for reshaped_hidden_states
																											SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = 2
																				self.assertEqual(out_len + added_hidden_states							,							len(UpperCamelCase_      )      )

																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = outputs.attentions

																				self.assertEqual(len(UpperCamelCase_      )							,							UpperCamelCase_      )

																				self.assertListEqual(
																				    list(self_attentions[0].shape[-3:]      )							,							[self.model_tester.num_heads[0], window_size_squared, window_size_squared]							,							)




						def      __lowerCamelCase       (    self :       Union[str, Any]							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       Optional[Any]      )     ->				Tuple:
													SCREAMING_SNAKE_CASE__     :Dict						    = model_class(UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()

													with torch.no_grad():
																				SCREAMING_SNAKE_CASE__     :Optional[int]						    = model(**self._prepare_for_class(UpperCamelCase_							,							UpperCamelCase_      )      )

													SCREAMING_SNAKE_CASE__     :Tuple						    = outputs.hidden_states

													SCREAMING_SNAKE_CASE__     :List[str]						    = getattr(
													    self.model_tester							,							'expected_num_hidden_layers'							,							len(self.model_tester.depths      ) + 1      )
													self.assertEqual(len(UpperCamelCase_      )							,							UpperCamelCase_      )

													# Swinv2 has a different seq_length
													SCREAMING_SNAKE_CASE__     :Tuple						    = (
													    config.patch_size
													    if isinstance(config.patch_size							,							collections.abc.Iterable      )
													    else (config.patch_size, config.patch_size)
													)

													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

													self.assertListEqual(
													    list(hidden_states[0].shape[-2:]      )							,							[num_patches, self.model_tester.embed_dim]							,							)

													SCREAMING_SNAKE_CASE__     :List[Any]						    = outputs.reshaped_hidden_states
													self.assertEqual(len(UpperCamelCase_      )							,							UpperCamelCase_      )

													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :List[Any]						    = reshaped_hidden_states[0].shape
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = (
													    reshaped_hidden_states[0].view(UpperCamelCase_							,							UpperCamelCase_							,							height * width      ).permute(0							,							2							,							1      )
													)
													self.assertListEqual(
													    list(reshaped_hidden_states.shape[-2:]      )							,							[num_patches, self.model_tester.embed_dim]							,							)




						def      __lowerCamelCase       (    self :       Any      )     ->				Dict:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :Optional[Any]						    = self.model_tester.prepare_config_and_inputs_for_common()

													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = (
													    self.model_tester.image_size
													    if isinstance(self.model_tester.image_size							,							collections.abc.Iterable      )
													    else (self.model_tester.image_size, self.model_tester.image_size)
													)

													for model_class in self.all_model_classes:
																				SCREAMING_SNAKE_CASE__     :List[Any]						    = True
																				self.check_hidden_states_output(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_      )

																				# check that output_hidden_states also work using config
																				del inputs_dict["output_hidden_states"]
																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = True

																				self.check_hidden_states_output(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Optional[Any]      )     ->				Optional[int]:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :List[str]						    = self.model_tester.prepare_config_and_inputs_for_common()
													SCREAMING_SNAKE_CASE__     :Tuple						    = 3

													SCREAMING_SNAKE_CASE__     :Optional[int]						    = (
													    self.model_tester.image_size
													    if isinstance(self.model_tester.image_size							,							collections.abc.Iterable      )
													    else (self.model_tester.image_size, self.model_tester.image_size)
													)
													SCREAMING_SNAKE_CASE__     :Dict						    = (
													    config.patch_size
													    if isinstance(config.patch_size							,							collections.abc.Iterable      )
													    else (config.patch_size, config.patch_size)
													)

													SCREAMING_SNAKE_CASE__     :Optional[int]						    = image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
													SCREAMING_SNAKE_CASE__     :List[str]						    = image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

													for model_class in self.all_model_classes:
																				SCREAMING_SNAKE_CASE__     :Any						    = True
																				self.check_hidden_states_output(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							(padded_height, padded_width)      )

																				# check that output_hidden_states also work using config
																				del inputs_dict["output_hidden_states"]
																				SCREAMING_SNAKE_CASE__     :Tuple						    = True
																				self.check_hidden_states_output(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							(padded_height, padded_width)      )




						def      __lowerCamelCase       (    self :       Tuple      )     ->				Optional[int]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_masked_image_modeling(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Optional[Any]      )     ->				Dict:
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_for_image_classification(*UpperCamelCase_      )




						@slow
						def      __lowerCamelCase       (    self :       Any      )     ->				List[str]:
													for model_name in SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = SwinvaModel.from_pretrained(UpperCamelCase_      )
																				self.assertIsNotNone(UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Union[str, Any]      )     ->				int:
													SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.prepare_config_and_inputs_for_common()

													SCREAMING_SNAKE_CASE__     :List[Any]						    = _config_zero_init(UpperCamelCase_      )
													for model_class in self.all_model_classes:
																				SCREAMING_SNAKE_CASE__     :Dict						    = model_class(config=UpperCamelCase_      )
																				for name, param in model.named_parameters():
																											if "embeddings" not in name and "logit_scale" not in name and param.requires_grad:
																																		self.assertIn(
																																		    ((param.data.mean() * 1e9).round() / 1e9).item()							,							[0.0, 1.0]							,							msg=f'''Parameter {name} of model {model_class} seems not properly initialized'''							,							)




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




						@cached_property
						def      __lowerCamelCase       (    self :       Dict      )     ->				Any:
													return (
													    AutoImageProcessor.from_pretrained('microsoft/swinv2-tiny-patch4-window8-256'      )
													    if is_vision_available()
													    else None
													)




						@slow
						def      __lowerCamelCase       (    self :       Tuple      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :Tuple						    = SwinvaForImageClassification.from_pretrained('microsoft/swinv2-tiny-patch4-window8-256'      ).to(
													    UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.default_image_processor

													SCREAMING_SNAKE_CASE__     :int						    = Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'      )
													SCREAMING_SNAKE_CASE__     :List[Any]						    = image_processor(images=UpperCamelCase_							,							return_tensors='pt'      ).to(UpperCamelCase_      )

													# forward pass
													with torch.no_grad():
																				SCREAMING_SNAKE_CASE__     :List[Any]						    = model(**UpperCamelCase_      )

													# verify the logits
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = torch.Size((1, 10_00)      )
													self.assertEqual(outputs.logits.shape							,							UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = torch.tensor([-0.3947, -0.4306, 0.0026]      ).to(UpperCamelCase_      )
													self.assertTrue(torch.allclose(outputs.logits[0, :3]							,							UpperCamelCase_							,							atol=1e-4      )      )







'''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 _SCREAMING_SNAKE_CASE:




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




						def      __lowerCamelCase       (    self :       Any      )     ->				Optional[Any]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = ids_tensor([self.batch_size, self.seq_length]							,							self.vocab_size      )

													SCREAMING_SNAKE_CASE__     :List[Any]						    = None
													if self.use_input_mask:
																				SCREAMING_SNAKE_CASE__     :str						    = random_attention_mask([self.batch_size, self.seq_length]      )

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

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

													SCREAMING_SNAKE_CASE__     :str						    = self.get_config()

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




						def      __lowerCamelCase       (    self :       List[str]      )     ->				Any:
													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=UpperCamelCase_							,							initializer_range=self.initializer_range							,							)




						def      __lowerCamelCase       (    self :       Optional[int]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       int      )     ->				int:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = MegatronBertModel(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :int						    = model(UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :str						    = model(UpperCamelCase_							,							token_type_ids=UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :List[str]						    = model(UpperCamelCase_      )

													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 :       str							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       Optional[Any]							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       Union[str, Any]      )     ->				List[str]:
													SCREAMING_SNAKE_CASE__     :str						    = MegatronBertForMaskedLM(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = model(UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_							,							labels=UpperCamelCase_      )
													self.parent.assertEqual(result.logits.shape							,							(self.batch_size, self.seq_length, self.vocab_size)      )




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




						def      __lowerCamelCase       (    self :       List[str]							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Optional[Any]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Optional[int]      )     ->				List[Any]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = MegatronBertForNextSentencePrediction(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :List[str]						    = model(
													    UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_							,							labels=UpperCamelCase_							,							)
													self.parent.assertEqual(result.logits.shape							,							(self.batch_size, 2)      )




						def      __lowerCamelCase       (    self :       Dict							,							UpperCamelCase_ :       List[Any]							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       Optional[int]      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :Tuple						    = MegatronBertForPreTraining(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = model(
													    UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_							,							labels=UpperCamelCase_							,							next_sentence_label=UpperCamelCase_							,							)
													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 :       Union[str, Any]							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       List[Any]							,							UpperCamelCase_ :       List[Any]      )     ->				Tuple:
													SCREAMING_SNAKE_CASE__     :int						    = MegatronBertForQuestionAnswering(config=UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :Tuple						    = model(
													    UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_							,							start_positions=UpperCamelCase_							,							end_positions=UpperCamelCase_							,							)
													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 :       List[Any]							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       Any							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       Any      )     ->				Dict:
													SCREAMING_SNAKE_CASE__     :List[Any]						    = self.num_labels
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = MegatronBertForSequenceClassification(UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.eval()
													SCREAMING_SNAKE_CASE__     :int						    = model(UpperCamelCase_							,							attention_mask=UpperCamelCase_							,							token_type_ids=UpperCamelCase_							,							labels=UpperCamelCase_      )
													self.parent.assertEqual(result.logits.shape							,							(self.batch_size, self.num_labels)      )




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




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




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




@require_torch
class _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE						,						_SCREAMING_SNAKE_CASE						,						unittest.TestCase					):
						A_			:							List[Any]     		= (
						    (
						        MegatronBertModel,
						        MegatronBertForMaskedLM,
						        MegatronBertForCausalLM,
						        MegatronBertForMultipleChoice,
						        MegatronBertForNextSentencePrediction,
						        MegatronBertForPreTraining,
						        MegatronBertForQuestionAnswering,
						        MegatronBertForSequenceClassification,
						        MegatronBertForTokenClassification,
						    )
						    if is_torch_available()
						    else ()
						)
						A_			:							List[Any]     		= (
						    {
						        '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 {}
						)
						A_			:							int     		= True
						# test_resize_embeddings = False
						A_			:							Dict     		= False




						def      __lowerCamelCase       (    self :       Union[str, Any]							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       str=False      )     ->				List[Any]:
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = super()._prepare_for_class(UpperCamelCase_							,							UpperCamelCase_							,							return_labels=UpperCamelCase_      )

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




						def      __lowerCamelCase       (    self :       Union[str, Any]      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :Dict						    = MegatronBertModelTester(self      )
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = ConfigTester(self							,							config_class=UpperCamelCase_							,							hidden_size=37      )




						def      __lowerCamelCase       (    self :       List[str]      )     ->				Optional[int]:
													self.config_tester.run_common_tests()




						def      __lowerCamelCase       (    self :       List[str]      )     ->				List[str]:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_model(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Any      )     ->				Tuple:
													SCREAMING_SNAKE_CASE__     :List[Any]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_masked_lm(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Union[str, Any]      )     ->				str:
													SCREAMING_SNAKE_CASE__     :Any						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       str      )     ->				Dict:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       int      )     ->				Any:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_pretraining(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Dict      )     ->				Union[str, Any]:
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_question_answering(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Any      )     ->				Union[str, Any]:
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       List[Any]      )     ->				Dict:
													SCREAMING_SNAKE_CASE__     :Dict						    = self.model_tester.prepare_config_and_inputs()
													self.model_tester.create_and_check_megatron_bert_for_token_classification(*UpperCamelCase_      )


def    lowerCamelCase       (			UpperCAmelCase__				:  Dict		)			->	Any:


							'''simple docstring'''






							return torch.tensor(
							    UpperCAmelCase__				,						dtype=torch.long				,						device=UpperCAmelCase__				,						)


UpperCamelCase_      	=	1e-4





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




						@slow
						@unittest.skip('Model is not available.'      )
						def      __lowerCamelCase       (    self :       str      )     ->				int:
													SCREAMING_SNAKE_CASE__     :Tuple						    = 'nvidia/megatron-bert-uncased-345m'
													if "MYDIR" in os.environ:
																				SCREAMING_SNAKE_CASE__     :Dict						    = os.path.join(os.environ['MYDIR']							,							UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Dict						    = MegatronBertModel.from_pretrained(UpperCamelCase_      )
													model.to(UpperCamelCase_      )
													model.half()
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = _long_tensor([[1_01, 71_10, 10_05, 10_56, 20_23, 1_13_33, 1_74_13, 10_29, 1_02]]      )
													with torch.no_grad():
																				SCREAMING_SNAKE_CASE__     :str						    = model(UpperCamelCase_      )[0]
													SCREAMING_SNAKE_CASE__     :Dict						    = torch.Size((1, 9, 10_24)      )
													self.assertEqual(output.shape							,							UpperCamelCase_      )

													SCREAMING_SNAKE_CASE__     :Tuple						    = [-0.6040, -0.2517, -0.1025, 0.3420, -0.6758, -0.0017, -0.1089, -0.1990, 0.5728]
													for ii in range(3      ):
																				for jj in range(3      ):
																											SCREAMING_SNAKE_CASE__     :List[Any]						    = output[0, ii, jj]
																											SCREAMING_SNAKE_CASE__     :List[str]						    = expected[3 * ii + jj]
																											SCREAMING_SNAKE_CASE__     :List[Any]						    = 'ii={} jj={} a={} b={}'.format(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_      )
																											self.assertTrue(math.isclose(UpperCamelCase_							,							UpperCamelCase_							,							rel_tol=UpperCamelCase_							,							abs_tol=UpperCamelCase_      )							,							msg=UpperCamelCase_      )






