
import unittest

from transformers import FunnelConfig, FunnelTokenizer, 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
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import (
							    MODEL_FOR_PRETRAINING_MAPPING,
							    FunnelBaseModel,
							    FunnelForMaskedLM,
							    FunnelForMultipleChoice,
							    FunnelForPreTraining,
							    FunnelForQuestionAnswering,
							    FunnelForSequenceClassification,
							    FunnelForTokenClassification,
							    FunnelModel,
							)
class      A__       :





							def __init__(			self  :       List[Any]					,			_UpperCAmelCase  :       Union[str, Any]					,			_UpperCAmelCase  :       int=13					,			_UpperCAmelCase  :       str=7					,			_UpperCAmelCase  :       Tuple=True					,			_UpperCAmelCase  :       Tuple=True					,			_UpperCAmelCase  :       Optional[int]=True					,			_UpperCAmelCase  :       List[str]=True					,			_UpperCAmelCase  :       Any=99					,			_UpperCAmelCase  :       List[Any]=[1, 1, 2]					,			_UpperCAmelCase  :       Union[str, Any]=1					,			_UpperCAmelCase  :       Optional[Any]=32					,			_UpperCAmelCase  :       List[str]=4					,			_UpperCAmelCase  :       int=8					,			_UpperCAmelCase  :       Union[str, Any]=37					,			_UpperCAmelCase  :       List[str]="gelu_new"					,			_UpperCAmelCase  :       Dict=0.1					,			_UpperCAmelCase  :       List[str]=0.1					,			_UpperCAmelCase  :       Tuple=0.0					,			_UpperCAmelCase  :       Any=5_12					,			_UpperCAmelCase  :       Optional[Any]=3					,			_UpperCAmelCase  :       List[Any]=0.02					,			_UpperCAmelCase  :       str=3					,			_UpperCAmelCase  :       List[Any]=4					,			_UpperCAmelCase  :       Dict=None					,			_UpperCAmelCase  :       int=False					,			)						->		Union[str, Any]:



											"""simple docstring"""


											__lowercase								= parent
											__lowercase								= batch_size
											__lowercase								= seq_length
											__lowercase								= is_training
											__lowercase								= use_input_mask
											__lowercase								= use_token_type_ids
											__lowercase								= use_labels
											__lowercase								= vocab_size
											__lowercase								= block_sizes
											__lowercase								= num_decoder_layers
											__lowercase								= d_model
											__lowercase								= n_head
											__lowercase								= d_head
											__lowercase								= d_inner
											__lowercase								= hidden_act
											__lowercase								= hidden_dropout
											__lowercase								= attention_dropout
											__lowercase								= activation_dropout
											__lowercase								= max_position_embeddings
											__lowercase								= type_vocab_size
											__lowercase								= 2
											__lowercase								= num_labels
											__lowercase								= num_choices
											__lowercase								= scope
											__lowercase								= initializer_std

											# Used in the tests to check the size of the first attention layer
											__lowercase								= n_head
											# Used in the tests to check the size of the first hidden state
											__lowercase								= self.d_model
											# Used in the tests to check the number of output hidden states/attentions
											__lowercase								= sum(self.block_sizes    ) + (0 if base else self.num_decoder_layers)
											# FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
											# the last hidden state of the first block (which is the first hidden state of the decoder).
											if not base:
															__lowercase								= self.num_hidden_layers + 2





							def       a__			(			self  :       Any    )						->		Any:



											"""simple docstring"""


											__lowercase								= ids_tensor([self.batch_size, self.seq_length]					,			self.vocab_size    )

											__lowercase								= None
											if self.use_input_mask:
															__lowercase								= ids_tensor([self.batch_size, self.seq_length]					,			vocab_size=2    )

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

											__lowercase								= None
											__lowercase								= None
											__lowercase								= None
											if self.use_labels:
															__lowercase								= ids_tensor([self.batch_size]					,			self.type_sequence_label_size    )
															__lowercase								= ids_tensor([self.batch_size, self.seq_length]					,			self.num_labels    )
															__lowercase								= ids_tensor([self.batch_size]					,			self.num_choices    )
															__lowercase								= ids_tensor([self.batch_size, self.seq_length]					,			1    )

											__lowercase								= self.get_config()

											return (
											    config,
											    input_ids,
											    token_type_ids,
											    input_mask,
											    sequence_labels,
											    token_labels,
											    choice_labels,
											    fake_token_labels,
											)





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



											"""simple docstring"""


											return FunnelConfig(
											    vocab_size=self.vocab_size					,			block_sizes=self.block_sizes					,			num_decoder_layers=self.num_decoder_layers					,			d_model=self.d_model					,			n_head=self.n_head					,			d_head=self.d_head					,			d_inner=self.d_inner					,			hidden_act=self.hidden_act					,			hidden_dropout=self.hidden_dropout					,			attention_dropout=self.attention_dropout					,			activation_dropout=self.activation_dropout					,			max_position_embeddings=self.max_position_embeddings					,			type_vocab_size=self.type_vocab_size					,			initializer_std=self.initializer_std					,			)





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



											"""simple docstring"""


											__lowercase								= FunnelModel(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= model(_UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )
											__lowercase								= model(_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, self.seq_length, self.d_model)    )

											__lowercase								= False
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, self.seq_length, self.d_model)    )

											__lowercase								= False
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, self.seq_length, self.d_model)    )





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



											"""simple docstring"""


											__lowercase								= FunnelBaseModel(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= model(_UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )
											__lowercase								= model(_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, 2, self.d_model)    )

											__lowercase								= False
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, 3, self.d_model)    )

											__lowercase								= False
											__lowercase								= model(_UpperCAmelCase    )
											self.parent.assertEqual(result.last_hidden_state.shape					,			(self.batch_size, 2, self.d_model)    )





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



											"""simple docstring"""


											__lowercase								= self.num_labels
											__lowercase								= FunnelForPreTraining(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= model(_UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase					,			labels=_UpperCAmelCase    )
											self.parent.assertEqual(result.logits.shape					,			(self.batch_size, self.seq_length)    )





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



											"""simple docstring"""


											__lowercase								= FunnelForMaskedLM(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= 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       a__			(			self  :       Optional[int]					,			_UpperCAmelCase  :       Optional[int]					,			_UpperCAmelCase  :       Tuple					,			_UpperCAmelCase  :       List[str]					,			_UpperCAmelCase  :       Dict					,			_UpperCAmelCase  :       str					,			_UpperCAmelCase  :       Any					,			_UpperCAmelCase  :       Optional[Any]					,			_UpperCAmelCase  :       List[str]					,			)						->		int:



											"""simple docstring"""


											__lowercase								= self.num_labels
											__lowercase								= FunnelForSequenceClassification(_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= model(_UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase					,			labels=_UpperCAmelCase    )
											self.parent.assertEqual(result.logits.shape					,			(self.batch_size, self.num_labels)    )





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



											"""simple docstring"""


											__lowercase								= self.num_choices
											__lowercase								= FunnelForMultipleChoice(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= input_ids.unsqueeze(1    ).expand(-1					,			self.num_choices					,			-1    ).contiguous()
											__lowercase								= token_type_ids.unsqueeze(1    ).expand(-1					,			self.num_choices					,			-1    ).contiguous()
											__lowercase								= input_mask.unsqueeze(1    ).expand(-1					,			self.num_choices					,			-1    ).contiguous()
											__lowercase								= model(
											    _UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase					,			labels=_UpperCAmelCase					,			)
											self.parent.assertEqual(result.logits.shape					,			(self.batch_size, self.num_choices)    )





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



											"""simple docstring"""


											__lowercase								= self.num_labels
											__lowercase								= FunnelForTokenClassification(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= 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       a__			(			self  :       Optional[Any]					,			_UpperCAmelCase  :       Dict					,			_UpperCAmelCase  :       int					,			_UpperCAmelCase  :       List[Any]					,			_UpperCAmelCase  :       int					,			_UpperCAmelCase  :       List[Any]					,			_UpperCAmelCase  :       int					,			_UpperCAmelCase  :       Tuple					,			_UpperCAmelCase  :       Dict					,			)						->		str:



											"""simple docstring"""


											__lowercase								= FunnelForQuestionAnswering(config=_UpperCAmelCase    )
											model.to(_UpperCAmelCase    )
											model.eval()
											__lowercase								= 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       a__			(			self  :       Any    )						->		Any:



											"""simple docstring"""


											__lowercase								= self.prepare_config_and_inputs()
											(
											    (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		, (
											    __lowercase 
											)		,  
											)								= config_and_inputs
											__lowercase								= {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
											return config, inputs_dict






@require_torch
class      A__       (						lowerCAmelCase__   ,						lowerCAmelCase__   ,						unittest.TestCase    ):
							lowerCAmelCase__		:						List[Any]         =							False
							lowerCAmelCase__		:						Tuple         =							False
							lowerCAmelCase__		:						Optional[Any]         =							(
							    (
							        FunnelModel,
							        FunnelForMaskedLM,
							        FunnelForPreTraining,
							        FunnelForQuestionAnswering,
							        FunnelForTokenClassification,
							    )
							    if is_torch_available()
							    else ()
							)
							lowerCAmelCase__		:						int         =							(
							    {
							        "feature-extraction": (FunnelBaseModel, FunnelModel),
							        "fill-mask": FunnelForMaskedLM,
							        "question-answering": FunnelForQuestionAnswering,
							        "text-classification": FunnelForSequenceClassification,
							        "token-classification": FunnelForTokenClassification,
							        "zero-shot": FunnelForSequenceClassification,
							    }
							    if is_torch_available()
							    else {}
							)





							def       a__			(			self  :       Optional[Any]					,			_UpperCAmelCase  :       str					,			_UpperCAmelCase  :       Dict					,			_UpperCAmelCase  :       List[str]=False    )						->		Optional[int]:



											"""simple docstring"""


											__lowercase								= super()._prepare_for_class(_UpperCAmelCase					,			_UpperCAmelCase					,			return_labels=_UpperCAmelCase    )

											if return_labels:
															if model_class in get_values(_UpperCAmelCase    ):
																			__lowercase								= torch.zeros(
																			    (self.model_tester.batch_size, self.model_tester.seq_length)					,			dtype=torch.long					,			device=_UpperCAmelCase    )
											return inputs_dict





							def       a__			(			self  :       Optional[int]    )						->		Tuple:



											"""simple docstring"""


											__lowercase								= FunnelModelTester(self    )
											__lowercase								= ConfigTester(self					,			config_class=_UpperCAmelCase    )





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



											"""simple docstring"""


											self.config_tester.run_common_tests()





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



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_UpperCAmelCase    )





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



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_pretraining(*_UpperCAmelCase    )





							def       a__			(			self  :       Optional[Any]    )						->		Optional[Any]:



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_lm(*_UpperCAmelCase    )





							def       a__			(			self  :       Dict    )						->		Tuple:



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*_UpperCAmelCase    )





							def       a__			(			self  :       Any    )						->		Dict:



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*_UpperCAmelCase    )





							def       a__			(			self  :       Tuple					,			_UpperCAmelCase  :       List[str]    )						->		List[Any]:



											"""simple docstring"""


											if hasattr(_UpperCAmelCase					,			'weight'    ) and module.weight is not None:
															module.weight.data.fill_(3    )
											if hasattr(_UpperCAmelCase					,			'bias'    ) and module.bias is not None:
															module.bias.data.fill_(3    )

											for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
															if hasattr(_UpperCAmelCase					,			_UpperCAmelCase    ) and getattr(_UpperCAmelCase					,			_UpperCAmelCase    ) is not None:
																			__lowercase								= getattr(_UpperCAmelCase					,			_UpperCAmelCase    )
																			weight.data.fill_(3    )






@require_torch
class      A__       (						lowerCAmelCase__   ,						unittest.TestCase    ):
							lowerCAmelCase__		:						List[str]         =							False
							lowerCAmelCase__		:						Any         =							False
							lowerCAmelCase__		:						List[Any]         =							(
							    (FunnelBaseModel, FunnelForMultipleChoice, FunnelForSequenceClassification) if is_torch_available() else ()
							)





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



											"""simple docstring"""


											__lowercase								= FunnelModelTester(self					,			base=_UpperCAmelCase    )
											__lowercase								= ConfigTester(self					,			config_class=_UpperCAmelCase    )





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



											"""simple docstring"""


											self.config_tester.run_common_tests()





							def       a__			(			self  :       int    )						->		List[str]:



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_base_model(*_UpperCAmelCase    )





							def       a__			(			self  :       Tuple    )						->		Dict:



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*_UpperCAmelCase    )





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



											"""simple docstring"""


											__lowercase								= self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_multiple_choice(*_UpperCAmelCase    )





							def       a__			(			self  :       List[str]    )						->		Optional[int]:



											"""simple docstring"""


											__lowercase		, __lowercase								= self.model_tester.prepare_config_and_inputs_for_common()
											__lowercase								= True

											for model_class in self.all_model_classes:
															if model_class.__name__ == "FunnelBaseModel":
																			continue
															__lowercase								= model_class(_UpperCAmelCase    )
															model.to(_UpperCAmelCase    )
															model.train()
															__lowercase								= self._prepare_for_class(_UpperCAmelCase					,			_UpperCAmelCase					,			return_labels=_UpperCAmelCase    )
															__lowercase								= model(**_UpperCAmelCase    ).loss
															loss.backward()





							def       a__			(			self  :       Dict					,			_UpperCAmelCase  :       Optional[Any]    )						->		List[str]:



											"""simple docstring"""


											if hasattr(_UpperCAmelCase					,			'weight'    ) and module.weight is not None:
															module.weight.data.fill_(3    )
											if hasattr(_UpperCAmelCase					,			'bias'    ) and module.bias is not None:
															module.bias.data.fill_(3    )

											for param in ["r_w_bias", "r_r_bias", "r_kernel", "r_s_bias", "seg_embed"]:
															if hasattr(_UpperCAmelCase					,			_UpperCAmelCase    ) and getattr(_UpperCAmelCase					,			_UpperCAmelCase    ) is not None:
																			__lowercase								= getattr(_UpperCAmelCase					,			_UpperCAmelCase    )
																			weight.data.fill_(3    )






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





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



											"""simple docstring"""


											__lowercase								= 13
											__lowercase								= 7
											__lowercase								= torch.arange(0					,			batch_size * sequence_length    ).long().reshape(_UpperCAmelCase					,			_UpperCAmelCase    )
											__lowercase								= [0, 1, 2, 3, 4, 5, 6, 4, 1, 3, 5, 0, 1]
											__lowercase								= torch.tensor([[2] + [0] * a + [1] * (sequence_length - a - 1) for a in lengths]    )

											__lowercase								= FunnelModel.from_pretrained('sgugger/funnel-random-tiny'    )
											__lowercase								= model(_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )[0].abs()

											__lowercase								= torch.tensor(23_44.83_52    )
											__lowercase								= torch.tensor(0.8_052    )
											self.assertTrue(torch.allclose(output.sum()					,			_UpperCAmelCase					,			atol=1e-4    )    )
											self.assertTrue(torch.allclose(output.mean()					,			_UpperCAmelCase					,			atol=1e-4    )    )

											__lowercase								= torch.tensor([[1] * 7, [1] * 4 + [0] * 3] * 6 + [[0, 1, 1, 0, 0, 1, 1]]    )
											__lowercase								= model(_UpperCAmelCase					,			attention_mask=_UpperCAmelCase					,			token_type_ids=_UpperCAmelCase    )[0].abs()

											__lowercase								= torch.tensor(23_43.84_25    )
											__lowercase								= torch.tensor(0.8_049    )
											self.assertTrue(torch.allclose(output.sum()					,			_UpperCAmelCase					,			atol=1e-4    )    )
											self.assertTrue(torch.allclose(output.mean()					,			_UpperCAmelCase					,			atol=1e-4    )    )





							@slow
							def       a__			(			self  :       Union[str, Any]    )						->		Optional[int]:



											"""simple docstring"""


											__lowercase								= FunnelTokenizer.from_pretrained('huggingface/funnel-small'    )
											__lowercase								= FunnelModel.from_pretrained('huggingface/funnel-small'    )
											__lowercase								= tokenizer('Hello! I am the Funnel Transformer model.'					,			return_tensors='pt'    )
											__lowercase								= model(**_UpperCAmelCase    )[0]

											__lowercase								= torch.tensor(235.7_246    )
											__lowercase								= torch.tensor(0.0_256    )
											self.assertTrue(torch.allclose(output.sum()					,			_UpperCAmelCase					,			atol=1e-4    )    )
											self.assertTrue(torch.allclose(output.mean()					,			_UpperCAmelCase					,			atol=1e-4    )    )








from math import pi




def 							__SCREAMING_SNAKE_CASE       (		SCREAMING_SNAKE_CASE	:				float      )					->						float:
				return degree / (180 / pi)


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

							testmod()





