



"""simple docstring"""






import unittest

from transformers import MobileBertConfig, 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,
	    MobileBertForMaskedLM,
	    MobileBertForMultipleChoice,
	    MobileBertForNextSentencePrediction,
	    MobileBertForPreTraining,
	    MobileBertForQuestionAnswering,
	    MobileBertForSequenceClassification,
	    MobileBertForTokenClassification,
	    MobileBertModel,
	)



class 			A__   :




	'''simple docstring'''





	def __init__(     self:		Tuple       ,			_SCREAMING_SNAKE_CASE:		Dict       ,			_SCREAMING_SNAKE_CASE:		Dict=13       ,			_SCREAMING_SNAKE_CASE:		Tuple=7       ,			_SCREAMING_SNAKE_CASE:		List[Any]=True       ,			_SCREAMING_SNAKE_CASE:		Optional[int]=True       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=True       ,			_SCREAMING_SNAKE_CASE:		List[Any]=True       ,			_SCREAMING_SNAKE_CASE:		str=99       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=64       ,			_SCREAMING_SNAKE_CASE:		List[str]=32       ,			_SCREAMING_SNAKE_CASE:		List[str]=5       ,			_SCREAMING_SNAKE_CASE:		int=4       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=37       ,			_SCREAMING_SNAKE_CASE:		str="gelu"       ,			_SCREAMING_SNAKE_CASE:		int=0.1       ,			_SCREAMING_SNAKE_CASE:		List[Any]=0.1       ,			_SCREAMING_SNAKE_CASE:		Any=512       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=16       ,			_SCREAMING_SNAKE_CASE:		Any=2       ,			_SCREAMING_SNAKE_CASE:		List[str]=0.02       ,			_SCREAMING_SNAKE_CASE:		List[str]=3       ,			_SCREAMING_SNAKE_CASE:		List[str]=4       ,			_SCREAMING_SNAKE_CASE:		Dict=None       ,			)				->       Tuple:

				"""simple docstring"""

				__lowerCAmelCase      :  int												=       parent
				__lowerCAmelCase      :  Any												=       batch_size
				__lowerCAmelCase      :  Union[str, Any]												=       seq_length
				__lowerCAmelCase      :  Union[str, Any]												=       is_training
				__lowerCAmelCase      :  Any												=       use_input_mask
				__lowerCAmelCase      :  Dict												=       use_token_type_ids
				__lowerCAmelCase      :  str												=       use_labels
				__lowerCAmelCase      :  Optional[Any]												=       vocab_size
				__lowerCAmelCase      :  int												=       hidden_size
				__lowerCAmelCase      :  Union[str, Any]												=       embedding_size
				__lowerCAmelCase      :  List[str]												=       num_hidden_layers
				__lowerCAmelCase      :  Union[str, Any]												=       num_attention_heads
				__lowerCAmelCase      :  Union[str, Any]												=       intermediate_size
				__lowerCAmelCase      :  Tuple												=       hidden_act
				__lowerCAmelCase      :  List[Any]												=       hidden_dropout_prob
				__lowerCAmelCase      :  Union[str, Any]												=       attention_probs_dropout_prob
				__lowerCAmelCase      :  Dict												=       max_position_embeddings
				__lowerCAmelCase      :  Union[str, Any]												=       type_vocab_size
				__lowerCAmelCase      :  Tuple												=       type_sequence_label_size
				__lowerCAmelCase      :  Optional[Any]												=       initializer_range
				__lowerCAmelCase      :  List[Any]												=       num_labels
				__lowerCAmelCase      :  int												=       num_choices
				__lowerCAmelCase      :  Dict												=       scope

	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[int])				->       List[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Dict												=       ids_tensor([self.batch_size, self.seq_length]       ,			self.vocab_size)

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

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

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

				__lowerCAmelCase      :  Tuple												=       self.get_config()

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

	def 							_SCREAMING_SNAKE_CASE   (     self:		Any)				->       Union[str, Any]:

				"""simple docstring"""

				return MobileBertConfig(
				    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=_SCREAMING_SNAKE_CASE       ,			initializer_range=self.initializer_range       ,			)

	def 							_SCREAMING_SNAKE_CASE   (     self:		Any       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		Tuple       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		Optional[int]       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Optional[int])				->       int:

				"""simple docstring"""

				__lowerCAmelCase      :  List[str]												=       MobileBertModel(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Optional[Any]												=       model(_SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  Optional[int]												=       model(_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  Optional[Any]												=       model(_SCREAMING_SNAKE_CASE)

				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 							_SCREAMING_SNAKE_CASE   (     self:		List[str]       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		Dict       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Any       ,			_SCREAMING_SNAKE_CASE:		str)				->       List[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       MobileBertForMaskedLM(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Any												=       model(_SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE)
				self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, self.seq_length, self.vocab_size))

	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Dict       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		List[str]       ,			_SCREAMING_SNAKE_CASE:		Optional[int]       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		int)				->       Any:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       MobileBertForNextSentencePrediction(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Union[str, Any]												=       model(
				    _SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE       ,			)
				self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, 2))

	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		List[str]       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		str       ,			_SCREAMING_SNAKE_CASE:		Tuple       ,			_SCREAMING_SNAKE_CASE:		str       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Tuple)				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  List[Any]												=       MobileBertForPreTraining(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Any												=       model(
				    _SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE       ,			next_sentence_label=_SCREAMING_SNAKE_CASE       ,			)
				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 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Optional[int]       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		Any       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Dict       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any])				->       Any:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[int]												=       MobileBertForQuestionAnswering(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Any												=       model(
				    _SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			start_positions=_SCREAMING_SNAKE_CASE       ,			end_positions=_SCREAMING_SNAKE_CASE       ,			)
				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 							_SCREAMING_SNAKE_CASE   (     self:		Tuple       ,			_SCREAMING_SNAKE_CASE:		Dict       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Any       ,			_SCREAMING_SNAKE_CASE:		List[str]       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		List[str]       ,			_SCREAMING_SNAKE_CASE:		str)				->       Optional[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  List[str]												=       self.num_labels
				__lowerCAmelCase      :  Optional[Any]												=       MobileBertForSequenceClassification(_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  Optional[Any]												=       model(_SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE)
				self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, self.num_labels))

	def 							_SCREAMING_SNAKE_CASE   (     self:		Any       ,			_SCREAMING_SNAKE_CASE:		Tuple       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]       ,			_SCREAMING_SNAKE_CASE:		str       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		Optional[Any])				->       int:

				"""simple docstring"""

				__lowerCAmelCase      :  Any												=       self.num_labels
				__lowerCAmelCase      :  Union[str, Any]												=       MobileBertForTokenClassification(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  int												=       model(_SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE)
				self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, self.seq_length, self.num_labels))

	def 							_SCREAMING_SNAKE_CASE   (     self:		Tuple       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		int       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		List[Any]       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]       ,			_SCREAMING_SNAKE_CASE:		Any)				->       Optional[int]:

				"""simple docstring"""

				__lowerCAmelCase      :  str												=       self.num_choices
				__lowerCAmelCase      :  Union[str, Any]												=       MobileBertForMultipleChoice(config=_SCREAMING_SNAKE_CASE)
				model.to(_SCREAMING_SNAKE_CASE)
				model.eval()
				__lowerCAmelCase      :  List[str]												=       input_ids.unsqueeze(1).expand(-1       ,			self.num_choices       ,			-1).contiguous()
				__lowerCAmelCase      :  str												=       token_type_ids.unsqueeze(1).expand(-1       ,			self.num_choices       ,			-1).contiguous()
				__lowerCAmelCase      :  List[Any]												=       input_mask.unsqueeze(1).expand(-1       ,			self.num_choices       ,			-1).contiguous()
				__lowerCAmelCase      :  int												=       model(
				    _SCREAMING_SNAKE_CASE       ,			attention_mask=_SCREAMING_SNAKE_CASE       ,			token_type_ids=_SCREAMING_SNAKE_CASE       ,			labels=_SCREAMING_SNAKE_CASE       ,			)
				self.parent.assertEqual(result.logits.shape       ,			(self.batch_size, self.num_choices))







	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any])				->       Dict:

				"""simple docstring"""

				__lowerCAmelCase      :  Tuple												=       self.prepare_config_and_inputs()
				(
				    (
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	(
				    __lowerCAmelCase
				)						,	
				)      :  Optional[int]												=       config_and_inputs
				__lowerCAmelCase      :  Tuple												=       {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
				return config, inputs_dict






@require_torch
class 			A__   (  __SCREAMING_SNAKE_CASE  ,		__SCREAMING_SNAKE_CASE  ,		unittest.TestCase							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	(
	    (
	        MobileBertModel,
	        MobileBertForMaskedLM,
	        MobileBertForMultipleChoice,
	        MobileBertForNextSentencePrediction,
	        MobileBertForPreTraining,
	        MobileBertForQuestionAnswering,
	        MobileBertForSequenceClassification,
	        MobileBertForTokenClassification,
	    )
	    if is_torch_available()
	    else ()
	)
	SCREAMING_SNAKE_CASE          =	(
	    {
	        'feature-extraction': MobileBertModel,
	        'fill-mask': MobileBertForMaskedLM,
	        'question-answering': MobileBertForQuestionAnswering,
	        'text-classification': MobileBertForSequenceClassification,
	        'token-classification': MobileBertForTokenClassification,
	        'zero-shot': MobileBertForSequenceClassification,
	    }
	    if is_torch_available()
	    else {}
	)
	SCREAMING_SNAKE_CASE          =	True

	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		Tuple       ,			_SCREAMING_SNAKE_CASE:		List[str]       ,			_SCREAMING_SNAKE_CASE:		Optional[int]=False)				->       List[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[int]												=       super()._prepare_for_class(_SCREAMING_SNAKE_CASE       ,			_SCREAMING_SNAKE_CASE       ,			return_labels=_SCREAMING_SNAKE_CASE)

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

	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any])				->       Any:

				"""simple docstring"""

				__lowerCAmelCase      :  Tuple												=       MobileBertModelTester(self)
				__lowerCAmelCase      :  Union[str, Any]												=       ConfigTester(self       ,			config_class=_SCREAMING_SNAKE_CASE       ,			hidden_size=37)

	def 							_SCREAMING_SNAKE_CASE   (     self:		int)				->       Tuple:

				"""simple docstring"""

				self.config_tester.run_common_tests()

	def 							_SCREAMING_SNAKE_CASE   (     self:		Tuple)				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  str												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_model(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[Any])				->       Optional[int]:

				"""simple docstring"""

				__lowerCAmelCase      :  Any												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_masked_lm(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		List[str])				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  Dict												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_multiple_choice(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		int)				->       Optional[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		str)				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  Tuple												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_pretraining(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[Any])				->       Optional[int]:

				"""simple docstring"""

				__lowerCAmelCase      :  Any												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_question_answering(*_SCREAMING_SNAKE_CASE)

	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[Any])				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_sequence_classification(*_SCREAMING_SNAKE_CASE)







	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[int])				->       int:

				"""simple docstring"""

				__lowerCAmelCase      :  int												=       self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_mobilebert_for_token_classification(*_SCREAMING_SNAKE_CASE)






def 			_lowercase				(  __snake_case	)						->   Optional[int]:
			return torch.tensor(
			    __snake_case					,dtype=torch.long					,device=__snake_case					,)


__snake_case							:   Any      =    1e-3





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




	'''simple docstring'''





	@slow
	def 							_SCREAMING_SNAKE_CASE   (     self:		str)				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  Tuple												=       MobileBertModel.from_pretrained("google/mobilebert-uncased").to(_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  List[str]												=       _long_tensor([[101, 7110, 1005, 1056, 2023, 1_1333, 1_7413, 1029, 102]])
				with torch.no_grad():
							__lowerCAmelCase      :  List[Any]												=       model(_SCREAMING_SNAKE_CASE)[0]
				__lowerCAmelCase      :  List[Any]												=       torch.Size((1, 9, 512))
				self.assertEqual(output.shape       ,			_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  Optional[int]												=       torch.tensor(
				    [
				        [
				            [-2.4736526e07, 8.2691656e04, 1.6521838e05],
				            [-5.7541704e-01, 3.9056022e00, 4.4011507e00],
				            [2.6047359e00, 1.5677652e00, -1.7324188e-01],
				        ]
				    ]       ,			device=_SCREAMING_SNAKE_CASE       ,			)

				# MobileBERT results range from 10e0 to 10e8. Even a 0.0000001% difference with a value of 10e8 results in a
				# ~1 difference, it's therefore not a good idea to measure using addition.
				# Here, we instead divide the expected result with the result in order to obtain ~1. We then check that the
				# result is held between bounds: 1 - TOLERANCE < expected_result / result < 1 + TOLERANCE
				__lowerCAmelCase      :  Union[str, Any]												=       torch.all((expected_slice / output[..., :3, :3]) >= 1 - TOLERANCE)
				__lowerCAmelCase      :  Optional[Any]												=       torch.all((expected_slice / output[..., :3, :3]) <= 1 + TOLERANCE)

				self.assertTrue(lower_bound and upper_bound)




"""simple docstring"""






from ..utils import DummyObject, requires_backends



class 			A__   (  metaclass=__SCREAMING_SNAKE_CASE							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	['torch', 'torchsde']

	def __init__(     self:		int       ,			*_SCREAMING_SNAKE_CASE:		Optional[Any]       ,			**_SCREAMING_SNAKE_CASE:		str)				->       Dict:

				"""simple docstring"""

				requires_backends(self       ,			["torch", "torchsde"])

	@classmethod
	def 							_SCREAMING_SNAKE_CASE   (     cls:		Optional[Any]       ,			*_SCREAMING_SNAKE_CASE:		Optional[int]       ,			**_SCREAMING_SNAKE_CASE:		Optional[int])				->       Optional[Any]:

				"""simple docstring"""

				requires_backends(cls       ,			["torch", "torchsde"])







	@classmethod
	def 							_SCREAMING_SNAKE_CASE   (     cls:		Dict       ,			*_SCREAMING_SNAKE_CASE:		List[Any]       ,			**_SCREAMING_SNAKE_CASE:		Any)				->       Optional[int]:

				"""simple docstring"""

				requires_backends(cls       ,			["torch", "torchsde"])