
"""simple docstring"""


import unittest

from transformers import MraConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_torch_available():
      import torch

      from transformers import (
          MraForMaskedLM,
          MraForMultipleChoice,
          MraForQuestionAnswering,
          MraForSequenceClassification,
          MraForTokenClassification,
          MraModel,
      )
      from transformers.models.mra.modeling_mra import MRA_PRETRAINED_MODEL_ARCHIVE_LIST



class   __a  :






       def __init__(  self :							int       ,      UpperCAmelCase_ :							Any       ,      UpperCAmelCase_ :							Optional[Any]=2       ,      UpperCAmelCase_ :							Optional[int]=8       ,      UpperCAmelCase_ :							int=True       ,      UpperCAmelCase_ :							Union[str, Any]=True       ,      UpperCAmelCase_ :							List[Any]=True       ,      UpperCAmelCase_ :							Dict=True       ,      UpperCAmelCase_ :							str=99       ,      UpperCAmelCase_ :							Optional[Any]=16       ,      UpperCAmelCase_ :							Optional[int]=5       ,      UpperCAmelCase_ :							Optional[int]=2       ,      UpperCAmelCase_ :							Any=36       ,      UpperCAmelCase_ :							List[Any]="gelu"       ,      UpperCAmelCase_ :							List[Any]=0.0       ,      UpperCAmelCase_ :							List[str]=0.0       ,      UpperCAmelCase_ :							int=512       ,      UpperCAmelCase_ :							int=16       ,      UpperCAmelCase_ :							Optional[Any]=2       ,      UpperCAmelCase_ :							Optional[int]=0.02       ,      UpperCAmelCase_ :							str=3       ,      UpperCAmelCase_ :							Dict=4       ,      UpperCAmelCase_ :							List[Any]=None       ,      )->  Dict:







              """simple docstring"""
              UpperCamelCase					 =		parent
              UpperCamelCase					 =		batch_size
              UpperCamelCase					 =		seq_length
              UpperCamelCase					 =		is_training
              UpperCamelCase					 =		use_input_mask
              UpperCamelCase					 =		use_token_type_ids
              UpperCamelCase					 =		use_labels
              UpperCamelCase					 =		vocab_size
              UpperCamelCase					 =		hidden_size
              UpperCamelCase					 =		num_hidden_layers
              UpperCamelCase					 =		num_attention_heads
              UpperCamelCase					 =		intermediate_size
              UpperCamelCase					 =		hidden_act
              UpperCamelCase					 =		hidden_dropout_prob
              UpperCamelCase					 =		attention_probs_dropout_prob
              UpperCamelCase					 =		max_position_embeddings
              UpperCamelCase					 =		type_vocab_size
              UpperCamelCase					 =		type_sequence_label_size
              UpperCamelCase					 =		initializer_range
              UpperCamelCase					 =		num_labels
              UpperCamelCase					 =		num_choices
              UpperCamelCase					 =		scope






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







              """simple docstring"""
              UpperCamelCase					 =		ids_tensor([self.batch_size, self.seq_length]       ,      self.vocab_size			)

              UpperCamelCase					 =		None
              if self.use_input_mask:
                     UpperCamelCase					 =		random_attention_mask([self.batch_size, self.seq_length]			)

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

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

              UpperCamelCase					 =		self.get_config()

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






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







              """simple docstring"""
              return MraConfig(
                  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       ,      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 	_SCREAMING_SNAKE_CASE       (  self :							Optional[Any]			)->  str:







              """simple docstring"""
              UpperCamelCase					 =		self.get_config()
              UpperCamelCase					 =		300
              return config






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







              """simple docstring"""
              (
                  (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       
              )					 =		self.prepare_config_and_inputs()

              UpperCamelCase					 =		True
              UpperCamelCase					 =		floats_tensor([self.batch_size, self.seq_length, self.hidden_size]			)
              UpperCamelCase					 =		ids_tensor([self.batch_size, self.seq_length]       ,      vocab_size=2			)

              return (
                  config,
                  input_ids,
                  token_type_ids,
                  input_mask,
                  sequence_labels,
                  token_labels,
                  choice_labels,
                  encoder_hidden_states,
                  encoder_attention_mask,
              )






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







              """simple docstring"""
              UpperCamelCase					 =		MraModel(config=UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		model(UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_			)
              UpperCamelCase					 =		model(UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_			)
              UpperCamelCase					 =		model(UpperCAmelCase_			)
              self.parent.assertEqual(result.last_hidden_state.shape       ,      (self.batch_size, self.seq_length, self.hidden_size)			)






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







              """simple docstring"""
              UpperCamelCase					 =		True
              UpperCamelCase					 =		MraModel(UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		model(
                  UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_       ,      encoder_hidden_states=UpperCAmelCase_       ,      encoder_attention_mask=UpperCAmelCase_       ,      )
              UpperCamelCase					 =		model(
                  UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_       ,      encoder_hidden_states=UpperCAmelCase_       ,      )
              UpperCamelCase					 =		model(UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_			)
              self.parent.assertEqual(result.last_hidden_state.shape       ,      (self.batch_size, self.seq_length, self.hidden_size)			)






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







              """simple docstring"""
              UpperCamelCase					 =		MraForMaskedLM(config=UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Tuple       ,      UpperCAmelCase_ :							int       ,      UpperCAmelCase_ :							int       ,      UpperCAmelCase_ :							List[Any]       ,      UpperCAmelCase_ :							Union[str, Any]       ,      UpperCAmelCase_ :							Union[str, Any]       ,      UpperCAmelCase_ :							int       ,      UpperCAmelCase_ :							Dict			)->  Optional[int]:







              """simple docstring"""
              UpperCamelCase					 =		MraForQuestionAnswering(config=UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							Optional[int]       ,      UpperCAmelCase_ :							Optional[Any]       ,      UpperCAmelCase_ :							int       ,      UpperCAmelCase_ :							str       ,      UpperCAmelCase_ :							Optional[int]       ,      UpperCAmelCase_ :							str       ,      UpperCAmelCase_ :							List[Any]       ,      UpperCAmelCase_ :							Union[str, Any]			)->  List[Any]:







              """simple docstring"""
              UpperCamelCase					 =		self.num_labels
              UpperCamelCase					 =		MraForSequenceClassification(UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		model(UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_       ,      labels=UpperCAmelCase_			)
              self.parent.assertEqual(result.logits.shape       ,      (self.batch_size, self.num_labels)			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.num_labels
              UpperCamelCase					 =		MraForTokenClassification(config=UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		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 	_SCREAMING_SNAKE_CASE       (  self :							int       ,      UpperCAmelCase_ :							List[str]       ,      UpperCAmelCase_ :							Tuple       ,      UpperCAmelCase_ :							Dict       ,      UpperCAmelCase_ :							Tuple       ,      UpperCAmelCase_ :							Optional[Any]       ,      UpperCAmelCase_ :							Tuple       ,      UpperCAmelCase_ :							Union[str, Any]			)->  List[Any]:







              """simple docstring"""
              UpperCamelCase					 =		self.num_choices
              UpperCamelCase					 =		MraForMultipleChoice(config=UpperCAmelCase_			)
              model.to(UpperCAmelCase_			)
              model.eval()
              UpperCamelCase					 =		input_ids.unsqueeze(1			).expand(-1       ,      self.num_choices       ,      -1			).contiguous()
              UpperCamelCase					 =		token_type_ids.unsqueeze(1			).expand(-1       ,      self.num_choices       ,      -1			).contiguous()
              UpperCamelCase					 =		input_mask.unsqueeze(1			).expand(-1       ,      self.num_choices       ,      -1			).contiguous()
              UpperCamelCase					 =		model(
                  UpperCAmelCase_       ,      attention_mask=UpperCAmelCase_       ,      token_type_ids=UpperCAmelCase_       ,      labels=UpperCAmelCase_       ,      )
              self.parent.assertEqual(result.logits.shape       ,      (self.batch_size, self.num_choices)			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.prepare_config_and_inputs()
              (
                  (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       (
                  UpperCamelCase
              ) ,       
              )					 =		config_and_inputs
              UpperCamelCase					 =		{"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
              return config, inputs_dict





@require_torch
class   __a  (      _lowerCAmelCase    ,     unittest.TestCase	):
       UpperCamelCase_		:					Dict   =			(
           (
               MraModel,
               MraForMaskedLM,
               MraForMultipleChoice,
               MraForQuestionAnswering,
               MraForSequenceClassification,
               MraForTokenClassification,
           )
           if is_torch_available()
           else ()
       )
       UpperCamelCase_		:					int   =			False
       UpperCamelCase_		:					List[Any]   =			False
       UpperCamelCase_		:					Tuple   =			False
       UpperCamelCase_		:					List[Any]   =			False

       UpperCamelCase_		:					Optional[Any]   =			()






       def 	_SCREAMING_SNAKE_CASE       (  self :							Any			)->  str:







              """simple docstring"""
              UpperCamelCase					 =		MraModelTester(self			)
              UpperCamelCase					 =		ConfigTester(self       ,      config_class=UpperCAmelCase_       ,      hidden_size=37			)






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







              """simple docstring"""
              self.config_tester.run_common_tests()






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_model(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              for type in ["absolute", "relative_key", "relative_key_query"]:
                     UpperCamelCase					 =		type
                     self.model_tester.create_and_check_model(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_masked_lm(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_multiple_choice(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_question_answering(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_sequence_classification(*UpperCAmelCase_			)






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







              """simple docstring"""
              UpperCamelCase					 =		self.model_tester.prepare_config_and_inputs()
              self.model_tester.create_and_check_for_token_classification(*UpperCAmelCase_			)






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







              """simple docstring"""
              for model_name in MRA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     UpperCamelCase					 =		MraModel.from_pretrained(UpperCAmelCase_			)
                     self.assertIsNotNone(UpperCAmelCase_			)






       @unittest.skip(reason="MRA does not output attentions"			)
       def 	_SCREAMING_SNAKE_CASE       (  self :							Optional[Any]			)->  List[Any]:







              """simple docstring"""
              return





@require_torch
class   __a  (      unittest.TestCase	):






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







              """simple docstring"""
              UpperCamelCase					 =		MraModel.from_pretrained("uw-madison/mra-base-512-4"			)
              UpperCamelCase					 =		torch.arange(256			).unsqueeze(0			)

              with torch.no_grad():
                     UpperCamelCase					 =		model(UpperCAmelCase_			)[0]

              UpperCamelCase					 =		torch.Size((1, 256, 768)			)
              self.assertEqual(output.shape       ,      UpperCAmelCase_			)

              UpperCamelCase					 =		torch.tensor(
                  [[[-0.0140, 0.0830, -0.0381], [0.1546, 0.1402, 0.0220], [0.1162, 0.0851, 0.0165]]]			)

              self.assertTrue(torch.allclose(output[:, :3, :3]       ,      UpperCAmelCase_       ,      atol=1e-4			)			)






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







              """simple docstring"""
              UpperCamelCase					 =		MraForMaskedLM.from_pretrained("uw-madison/mra-base-512-4"			)
              UpperCamelCase					 =		torch.arange(256			).unsqueeze(0			)

              with torch.no_grad():
                     UpperCamelCase					 =		model(UpperCAmelCase_			)[0]

              UpperCamelCase					 =		50_265

              UpperCamelCase					 =		torch.Size((1, 256, vocab_size)			)
              self.assertEqual(output.shape       ,      UpperCAmelCase_			)

              UpperCamelCase					 =		torch.tensor(
                  [[[9.2595, -3.6038, 11.8819], [9.3869, -3.2693, 11.0956], [11.8524, -3.4938, 13.1210]]]			)

              self.assertTrue(torch.allclose(output[:, :3, :3]       ,      UpperCAmelCase_       ,      atol=1e-4			)			)






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







              """simple docstring"""
              UpperCamelCase					 =		MraForMaskedLM.from_pretrained("uw-madison/mra-base-4096-8-d3"			)
              UpperCamelCase					 =		torch.arange(4_096			).unsqueeze(0			)

              with torch.no_grad():
                     UpperCamelCase					 =		model(UpperCAmelCase_			)[0]

              UpperCamelCase					 =		50_265

              UpperCamelCase					 =		torch.Size((1, 4_096, vocab_size)			)
              self.assertEqual(output.shape       ,      UpperCAmelCase_			)

              UpperCamelCase					 =		torch.tensor(
                  [[[5.4789, -2.3564, 7.5064], [7.9067, -1.3369, 9.9668], [9.0712, -1.8106, 7.0380]]]			)

              self.assertTrue(torch.allclose(output[:, :3, :3]       ,      UpperCAmelCase_       ,      atol=1e-4			)			)







"""simple docstring"""


import unittest

from transformers.utils.backbone_utils import (
    BackboneMixin,
    get_aligned_output_features_output_indices,
    verify_out_features_out_indices,
)



class   __a  (      unittest.TestCase	):






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







              """simple docstring"""
              UpperCamelCase					 =		["a", "b", "c"]

              # Defaults to last layer if both are None
              UpperCamelCase ,       UpperCamelCase					 =		get_aligned_output_features_output_indices(UpperCAmelCase_       ,      UpperCAmelCase_       ,      UpperCAmelCase_			)
              self.assertEqual(UpperCAmelCase_       ,      ["c"]			)
              self.assertEqual(UpperCAmelCase_       ,      [2]			)

              # Out indices set to match out features
              UpperCamelCase ,       UpperCamelCase					 =		get_aligned_output_features_output_indices(["a", "c"]       ,      UpperCAmelCase_       ,      UpperCAmelCase_			)
              self.assertEqual(UpperCAmelCase_       ,      ["a", "c"]			)
              self.assertEqual(UpperCAmelCase_       ,      [0, 2]			)

              # Out features set to match out indices
              UpperCamelCase ,       UpperCamelCase					 =		get_aligned_output_features_output_indices(UpperCAmelCase_       ,      [0, 2]       ,      UpperCAmelCase_			)
              self.assertEqual(UpperCAmelCase_       ,      ["a", "c"]			)
              self.assertEqual(UpperCAmelCase_       ,      [0, 2]			)

              # Out features selected from negative indices
              UpperCamelCase ,       UpperCamelCase					 =		get_aligned_output_features_output_indices(UpperCAmelCase_       ,      [-3, -1]       ,      UpperCAmelCase_			)
              self.assertEqual(UpperCAmelCase_       ,      ["a", "c"]			)
              self.assertEqual(UpperCAmelCase_       ,      [-3, -1]			)






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







              """simple docstring"""
              # Stage names must be set
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(["a", "b"]       ,      (0, 1)       ,      UpperCAmelCase_			)

              # Out features must be a list
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(("a", "b")       ,      (0, 1)       ,      ["a", "b"]			)

              # Out features must be a subset of stage names
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(["a", "b"]       ,      (0, 1)       ,      ["a"]			)

              # Out indices must be a list or tuple
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(UpperCAmelCase_       ,      0       ,      ["a", "b"]			)

              # Out indices must be a subset of stage names
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(UpperCAmelCase_       ,      (0, 1)       ,      ["a"]			)

              # Out features and out indices must be the same length
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(["a", "b"]       ,      (0,)       ,      ["a", "b", "c"]			)

              # Out features should match out indices
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(["a", "b"]       ,      (0, 2)       ,      ["a", "b", "c"]			)

              # Out features and out indices should be in order
              with self.assertRaises(UpperCAmelCase_			):
                     verify_out_features_out_indices(["b", "a"]       ,      (0, 1)       ,      ["a", "b"]			)

              # Check passes with valid inputs
              verify_out_features_out_indices(["a", "b", "d"]       ,      (0, 1, -1)       ,      ["a", "b", "c", "d"]			)






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







              """simple docstring"""
              UpperCamelCase					 =		BackboneMixin()

              UpperCamelCase					 =		["a", "b", "c"]
              UpperCamelCase					 =		["a", "c"]
              UpperCamelCase					 =		[0, 2]

              # Check that the output features and indices are set correctly
              self.assertEqual(backbone.out_features       ,      ["a", "c"]			)
              self.assertEqual(backbone.out_indices       ,      [0, 2]			)

              # Check out features and indices are updated correctly
              UpperCamelCase					 =		["a", "b"]
              self.assertEqual(backbone.out_features       ,      ["a", "b"]			)
              self.assertEqual(backbone.out_indices       ,      [0, 1]			)

              UpperCamelCase					 =		[-3, -1]
              self.assertEqual(backbone.out_features       ,      ["a", "c"]			)
              self.assertEqual(backbone.out_indices       ,      [-3, -1]			)





