



"""simple docstring"""







from __future__ import annotations

import unittest

from transformers import LEDConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import TFLEDForConditionalGeneration, TFLEDModel







@require_tf
class 				UpperCamelCase__       :




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					LEDConfig
      _SCREAMING_SNAKE_CASE      =					{}
      _SCREAMING_SNAKE_CASE      =					"""gelu"""



      def __init__(				self    :				Union[str, Any]   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=1_3   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=7   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=True   ,      SCREAMING_SNAKE_CASE_    :				int=False   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=9_9   ,      SCREAMING_SNAKE_CASE_    :				List[str]=3_2   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=2   ,      SCREAMING_SNAKE_CASE_    :				Tuple=4   ,      SCREAMING_SNAKE_CASE_    :				Any=3_7   ,      SCREAMING_SNAKE_CASE_    :				int=0.1   ,      SCREAMING_SNAKE_CASE_    :				str=0.1   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=2_0   ,      SCREAMING_SNAKE_CASE_    :				Any=2   ,      SCREAMING_SNAKE_CASE_    :				int=1   ,      SCREAMING_SNAKE_CASE_    :				Any=0   ,      SCREAMING_SNAKE_CASE_    :				str=4   ,      ):
        lowerCAmelCase_       :    Dict								=			parent
        lowerCAmelCase_       :    str								=			batch_size
        lowerCAmelCase_       :    Tuple								=			seq_length
        lowerCAmelCase_       :    Dict								=			is_training
        lowerCAmelCase_       :    List[str]								=			use_labels
        lowerCAmelCase_       :    Any								=			vocab_size
        lowerCAmelCase_       :    Optional[Any]								=			hidden_size
        lowerCAmelCase_       :    Optional[int]								=			num_hidden_layers
        lowerCAmelCase_       :    List[Any]								=			num_attention_heads
        lowerCAmelCase_       :    Optional[int]								=			intermediate_size

        lowerCAmelCase_       :    Optional[int]								=			hidden_dropout_prob
        lowerCAmelCase_       :    List[Any]								=			attention_probs_dropout_prob
        lowerCAmelCase_       :    Optional[Any]								=			max_position_embeddings
        lowerCAmelCase_       :    Optional[int]								=			eos_token_id
        lowerCAmelCase_       :    Optional[Any]								=			pad_token_id
        lowerCAmelCase_       :    Union[str, Any]								=			bos_token_id
        lowerCAmelCase_       :    Optional[Any]								=			attention_window

        # `ModelTesterMixin.test_attention_outputs` is expecting attention tensors to be of size
        # [num_attention_heads, encoder_seq_length, encoder_key_length], but TFLongformerSelfAttention
        # returns attention of shape [num_attention_heads, encoder_seq_length, self.attention_window + 1]
        # because its local attention only attends to `self.attention_window` and one before and one after
        lowerCAmelCase_       :    Tuple								=			self.attention_window + 2

        # because of padding `encoder_seq_length`, is different from `seq_length`. Relevant for
        # the `test_attention_outputs` and `test_hidden_states_output` tests
        lowerCAmelCase_       :    Union[str, Any]								=			(
            self.seq_length + (self.attention_window - self.seq_length % self.attention_window) % self.attention_window
        )



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Any	):
        lowerCAmelCase_       :    int								=			ids_tensor([self.batch_size, self.seq_length - 1]   ,      self.vocab_size	)
        lowerCAmelCase_       :    List[Any]								=			tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size	)   ,      1	)
        lowerCAmelCase_       :    Union[str, Any]								=			tf.concat([input_ids, eos_tensor]   ,      axis=1	)

        lowerCAmelCase_       :    Union[str, Any]								=			ids_tensor([self.batch_size, self.seq_length]   ,      self.vocab_size	)

        lowerCAmelCase_       :    Dict								=			self.config_cls(
            vocab_size=self.vocab_size   ,      d_model=self.hidden_size   ,      encoder_layers=self.num_hidden_layers   ,      decoder_layers=self.num_hidden_layers   ,      encoder_attention_heads=self.num_attention_heads   ,      decoder_attention_heads=self.num_attention_heads   ,      encoder_ffn_dim=self.intermediate_size   ,      decoder_ffn_dim=self.intermediate_size   ,      dropout=self.hidden_dropout_prob   ,      attention_dropout=self.attention_probs_dropout_prob   ,      max_position_embeddings=self.max_position_embeddings   ,      eos_token_ids=[2]   ,      bos_token_id=self.bos_token_id   ,      pad_token_id=self.pad_token_id   ,      decoder_start_token_id=self.pad_token_id   ,      attention_window=self.attention_window   ,      **self.config_updates   ,      )
        lowerCAmelCase_       :    Union[str, Any]								=			prepare_led_inputs_dict(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Dict								=			tf.concat(
            [tf.zeros_like(SCREAMING_SNAKE_CASE_	)[:, :-1], tf.ones_like(SCREAMING_SNAKE_CASE_	)[:, -1:]]   ,      axis=-1   ,      )
        lowerCAmelCase_       :    List[str]								=			global_attention_mask
        return config, inputs_dict





      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Tuple	):
        lowerCAmelCase_       :    int								=			TFLEDModel(config=SCREAMING_SNAKE_CASE_	).get_decoder()
        lowerCAmelCase_       :    str								=			inputs_dict['input_ids']

        lowerCAmelCase_       :    Union[str, Any]								=			input_ids[:1, :]
        lowerCAmelCase_       :    Optional[Any]								=			inputs_dict['attention_mask'][:1, :]
        lowerCAmelCase_       :    Optional[Any]								=			1

        # first forward pass
        lowerCAmelCase_       :    Dict								=			model(SCREAMING_SNAKE_CASE_   ,      attention_mask=SCREAMING_SNAKE_CASE_   ,      use_cache=SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_						,lowerCAmelCase_       :    Any								=			outputs.to_tuple()

        # create hypothetical next token and extent to next_input_ids
        lowerCAmelCase_       :    Optional[int]								=			ids_tensor((self.batch_size, 3)   ,      config.vocab_size	)
        lowerCAmelCase_       :    Union[str, Any]								=			tf.cast(ids_tensor((self.batch_size, 3)   ,      2	)   ,      tf.inta	)

        # append to next input_ids and
        lowerCAmelCase_       :    Union[str, Any]								=			tf.concat([input_ids, next_tokens]   ,      axis=-1	)
        lowerCAmelCase_       :    List[str]								=			tf.concat([attention_mask, next_attn_mask]   ,      axis=-1	)

        lowerCAmelCase_       :    str								=			model(SCREAMING_SNAKE_CASE_   ,      attention_mask=SCREAMING_SNAKE_CASE_	)[0]
        lowerCAmelCase_       :    Union[str, Any]								=			model(SCREAMING_SNAKE_CASE_   ,      attention_mask=SCREAMING_SNAKE_CASE_   ,      past_key_values=SCREAMING_SNAKE_CASE_	)[0]

        self.parent.assertEqual(next_tokens.shape[1]   ,      output_from_past.shape[1]	)

        # select random slice
        lowerCAmelCase_       :    Union[str, Any]								=			int(ids_tensor((1,)   ,      output_from_past.shape[-1]	)	)
        lowerCAmelCase_       :    Optional[Any]								=			output_from_no_past[:, -3:, random_slice_idx]
        lowerCAmelCase_       :    Dict								=			output_from_past[:, :, random_slice_idx]

        # test that outputs are equal for slice
        tf.debugging.assert_near(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_   ,      rtol=1E-3	)




def     UpperCamelCase_   (   lowerCAmelCase__				:    List[str]   ,       lowerCAmelCase__				:    List[str]   ,       lowerCAmelCase__				:    List[str]   ,       lowerCAmelCase__				:    Any=None   ,       lowerCAmelCase__				:    Union[str, Any]=None   ,       lowerCAmelCase__				:    Optional[int]=None   ,       lowerCAmelCase__				:    Optional[Any]=None   ,       )						->       Dict:

  """simple docstring"""




  if attention_mask is None:
    lowerCAmelCase_       :    Any								=			tf.cast(tf.math.not_equal(lowerCAmelCase__   ,       config.pad_token_id						)   ,       tf.inta						)
  if decoder_attention_mask is None:
    lowerCAmelCase_       :    Tuple								=			tf.concat(
        [
            tf.ones(decoder_input_ids[:, :1].shape   ,       dtype=tf.inta						),
            tf.cast(tf.math.not_equal(decoder_input_ids[:, 1:]   ,       config.pad_token_id						)   ,       tf.inta						),
        ]   ,       axis=-1   ,       )
  if head_mask is None:
    lowerCAmelCase_       :    List[str]								=			tf.ones((config.encoder_layers, config.encoder_attention_heads)						)
  if decoder_head_mask is None:
    lowerCAmelCase_       :    Dict								=			tf.ones((config.decoder_layers, config.decoder_attention_heads)						)
  return {
      "input_ids": input_ids,
      "attention_mask": attention_mask,
      "decoder_input_ids": decoder_input_ids,
      "decoder_attention_mask": decoder_attention_mask,
      "head_mask": head_mask,
      "decoder_head_mask": decoder_head_mask,
  }







@require_tf
class 				UpperCamelCase__       (     lowercase_, lowercase_, unittest.TestCase  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					(TFLEDForConditionalGeneration, TFLEDModel) if is_tf_available() else ()
      _SCREAMING_SNAKE_CASE      =					(TFLEDForConditionalGeneration,) if is_tf_available() else ()
      _SCREAMING_SNAKE_CASE      =					(
          {
              """conversational""": TFLEDForConditionalGeneration,
              """feature-extraction""": TFLEDModel,
              """summarization""": TFLEDForConditionalGeneration,
              """text2text-generation""": TFLEDForConditionalGeneration,
              """translation""": TFLEDForConditionalGeneration,
          }
          if is_tf_available()
          else {}
      )
      _SCREAMING_SNAKE_CASE      =					True
      _SCREAMING_SNAKE_CASE      =					False
      _SCREAMING_SNAKE_CASE      =					False
      _SCREAMING_SNAKE_CASE      =					False



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]	):
        lowerCAmelCase_       :    Tuple								=			TFLEDModelTester(self	)
        lowerCAmelCase_       :    Tuple								=			ConfigTester(self   ,      config_class=SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[int]	):
        self.config_tester.run_common_tests()



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Dict	):
        lowerCAmelCase_       :    int								=			self.model_tester.prepare_config_and_inputs_for_common()
        self.model_tester.check_decoder_model_past_large_inputs(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_						,lowerCAmelCase_       :    List[Any]								=			self.model_tester.prepare_config_and_inputs_for_common()
        lowerCAmelCase_       :    str								=			tf.zeros_like(inputs_dict['attention_mask']	)
        lowerCAmelCase_       :    Optional[Any]								=			2
        lowerCAmelCase_       :    Union[str, Any]								=			tf.where(
            tf.range(self.model_tester.seq_length	)[None, :] < num_global_attn_indices   ,      1   ,      inputs_dict['global_attention_mask']   ,      )

        lowerCAmelCase_       :    str								=			True
        lowerCAmelCase_       :    List[str]								=			self.model_tester.seq_length
        lowerCAmelCase_       :    List[Any]								=			self.model_tester.encoder_seq_length

        def check_decoder_attentions_output(SCREAMING_SNAKE_CASE_    :				Dict	):
          lowerCAmelCase_       :    List[str]								=			outputs.decoder_attentions
          self.assertEqual(len(SCREAMING_SNAKE_CASE_	)   ,      self.model_tester.num_hidden_layers	)
          self.assertListEqual(
              list(decoder_attentions[0].shape[-3:]	)   ,      [self.model_tester.num_attention_heads, seq_length, seq_length]   ,      )

        def check_encoder_attentions_output(SCREAMING_SNAKE_CASE_    :				Union[str, Any]	):
          lowerCAmelCase_       :    Union[str, Any]								=			[t.numpy() for t in outputs.encoder_attentions]
          lowerCAmelCase_       :    List[Any]								=			[t.numpy() for t in outputs.encoder_global_attentions]
          self.assertEqual(len(SCREAMING_SNAKE_CASE_	)   ,      self.model_tester.num_hidden_layers	)
          self.assertEqual(len(SCREAMING_SNAKE_CASE_	)   ,      self.model_tester.num_hidden_layers	)
          self.assertListEqual(
              list(attentions[0].shape[-3:]	)   ,      [self.model_tester.num_attention_heads, seq_length, seq_length]   ,      )
          self.assertListEqual(
              list(global_attentions[0].shape[-3:]	)   ,      [self.model_tester.num_attention_heads, encoder_seq_length, num_global_attn_indices]   ,      )

        for model_class in self.all_model_classes:
          lowerCAmelCase_       :    Dict								=			True
          lowerCAmelCase_       :    Tuple								=			False
          lowerCAmelCase_       :    List[Any]								=			False
          lowerCAmelCase_       :    Optional[int]								=			model_class(SCREAMING_SNAKE_CASE_	)
          lowerCAmelCase_       :    List[Any]								=			model(self._prepare_for_class(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)	)
          lowerCAmelCase_       :    int								=			len(SCREAMING_SNAKE_CASE_	)
          self.assertEqual(config.output_hidden_states   ,      SCREAMING_SNAKE_CASE_	)
          check_encoder_attentions_output(SCREAMING_SNAKE_CASE_	)

          if self.is_encoder_decoder:
            lowerCAmelCase_       :    Tuple								=			model_class(SCREAMING_SNAKE_CASE_	)
            lowerCAmelCase_       :    Dict								=			model(self._prepare_for_class(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)	)
            self.assertEqual(config.output_hidden_states   ,      SCREAMING_SNAKE_CASE_	)
            check_decoder_attentions_output(SCREAMING_SNAKE_CASE_	)

          # Check that output attentions can also be changed via the config
          del inputs_dict["output_attentions"]
          lowerCAmelCase_       :    Any								=			True
          lowerCAmelCase_       :    Optional[int]								=			model_class(SCREAMING_SNAKE_CASE_	)
          lowerCAmelCase_       :    List[str]								=			model(self._prepare_for_class(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)	)
          self.assertEqual(config.output_hidden_states   ,      SCREAMING_SNAKE_CASE_	)
          check_encoder_attentions_output(SCREAMING_SNAKE_CASE_	)

          # Check attention is always last and order is fine
          lowerCAmelCase_       :    int								=			True
          lowerCAmelCase_       :    str								=			True
          lowerCAmelCase_       :    Union[str, Any]								=			model_class(SCREAMING_SNAKE_CASE_	)
          lowerCAmelCase_       :    Dict								=			model(self._prepare_for_class(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)	)

          self.assertEqual(out_len + (2 if self.is_encoder_decoder else 1)   ,      len(SCREAMING_SNAKE_CASE_	)	)
          self.assertEqual(model.config.output_hidden_states   ,      SCREAMING_SNAKE_CASE_	)
          check_encoder_attentions_output(SCREAMING_SNAKE_CASE_	)



      @unittest.skip('LED keeps using potentially symbolic tensors in conditionals and breaks tracing.'	)
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        pass





      def 					SCREAMING_SNAKE_CASE__			(				self    :				Dict	):
        # TODO: Head-masking not yet implement
        pass




def     UpperCamelCase_   (   lowerCAmelCase__				:    Dict						)						->       List[str]:

  """simple docstring"""




  return tf.constant(lowerCAmelCase__   ,       dtype=tf.intaa						)


lowercase__		:    Dict				   =     1e-4







@slow
@require_tf
class 				UpperCamelCase__       (     unittest.TestCase  ):




      """simple docstring"""




      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]	):
        lowerCAmelCase_       :    List[Any]								=			TFLEDForConditionalGeneration.from_pretrained('allenai/led-base-16384'	).led

        # change to intended input here
        lowerCAmelCase_       :    Optional[int]								=			_long_tensor([5_1_2 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]	)
        lowerCAmelCase_       :    List[str]								=			_long_tensor([1_2_8 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]	)
        lowerCAmelCase_       :    Optional[int]								=			prepare_led_inputs_dict(model.config   ,      SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    List[Any]								=			model(**SCREAMING_SNAKE_CASE_	)[0]
        lowerCAmelCase_       :    Dict								=			(1, 1_0_2_4, 7_6_8)
        self.assertEqual(output.shape   ,      SCREAMING_SNAKE_CASE_	)
        # change to expected output here
        lowerCAmelCase_       :    Optional[int]								=			tf.convert_to_tensor(
            [[2.30_50, 2.82_79, 0.65_31], [-1.84_57, -0.14_55, -3.56_61], [-1.01_86, 0.45_86, -2.20_43]]   ,      )
        tf.debugging.assert_near(output[:, :3, :3]   ,      SCREAMING_SNAKE_CASE_   ,      atol=1E-3	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[int]	):
        lowerCAmelCase_       :    Union[str, Any]								=			TFLEDForConditionalGeneration.from_pretrained('allenai/led-base-16384'	)

        # change to intended input here
        lowerCAmelCase_       :    Tuple								=			_long_tensor([5_1_2 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]	)
        lowerCAmelCase_       :    int								=			_long_tensor([1_2_8 * [0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9]]	)
        lowerCAmelCase_       :    Optional[int]								=			prepare_led_inputs_dict(model.config   ,      SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Tuple								=			model(**SCREAMING_SNAKE_CASE_	)[0]
        lowerCAmelCase_       :    Any								=			(1, 1_0_2_4, model.config.vocab_size)
        self.assertEqual(output.shape   ,      SCREAMING_SNAKE_CASE_	)
        # change to expected output here
        lowerCAmelCase_       :    str								=			tf.convert_to_tensor(
            [[33.65_07, 6.45_72, 16.80_89], [5.87_39, -2.42_38, 11.29_02], [-3.21_39, -4.31_49, 4.27_83]]   ,      )
        tf.debugging.assert_near(output[:, :3, :3]   ,      SCREAMING_SNAKE_CASE_   ,      atol=1E-3   ,      rtol=1E-3	)










"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


lowercase__		:    Optional[int]				   =     logging.get_logger(__name__)







class 				UpperCamelCase__       (     lowercase_, lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					"""maskformer-swin"""

      _SCREAMING_SNAKE_CASE      =					{
          """num_attention_heads""": """num_heads""",
          """num_hidden_layers""": """num_layers""",
      }



      def __init__(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=2_2_4   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=4   ,      SCREAMING_SNAKE_CASE_    :				int=3   ,      SCREAMING_SNAKE_CASE_    :				Dict=9_6   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=[2, 2, 6, 2]   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=[3, 6, 1_2, 2_4]   ,      SCREAMING_SNAKE_CASE_    :				List[str]=7   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=4.0   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=True   ,      SCREAMING_SNAKE_CASE_    :				Tuple=0.0   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=0.0   ,      SCREAMING_SNAKE_CASE_    :				int=0.1   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]="gelu"   ,      SCREAMING_SNAKE_CASE_    :				Dict=False   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=0.02   ,      SCREAMING_SNAKE_CASE_    :				int=1E-5   ,      SCREAMING_SNAKE_CASE_    :				Dict=None   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=None   ,      **SCREAMING_SNAKE_CASE_    :				str   ,      ):
        super().__init__(**SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    Dict								=			image_size
        lowerCAmelCase_       :    Optional[Any]								=			patch_size
        lowerCAmelCase_       :    Optional[int]								=			num_channels
        lowerCAmelCase_       :    List[str]								=			embed_dim
        lowerCAmelCase_       :    Dict								=			depths
        lowerCAmelCase_       :    Optional[Any]								=			len(SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Tuple								=			num_heads
        lowerCAmelCase_       :    List[str]								=			window_size
        lowerCAmelCase_       :    Any								=			mlp_ratio
        lowerCAmelCase_       :    Any								=			qkv_bias
        lowerCAmelCase_       :    List[Any]								=			hidden_dropout_prob
        lowerCAmelCase_       :    List[Any]								=			attention_probs_dropout_prob
        lowerCAmelCase_       :    Tuple								=			drop_path_rate
        lowerCAmelCase_       :    List[str]								=			hidden_act
        lowerCAmelCase_       :    Any								=			use_absolute_embeddings
        lowerCAmelCase_       :    Optional[Any]								=			layer_norm_eps
        lowerCAmelCase_       :    str								=			initializer_range
        # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
        # this indicates the channel dimension after the last stage of the model
        lowerCAmelCase_       :    List[str]								=			int(embed_dim * 2 ** (len(SCREAMING_SNAKE_CASE_	) - 1)	)
        lowerCAmelCase_       :    List[Any]								=			['stem'] + [F"stage{idx}" for idx in range(1   ,      len(SCREAMING_SNAKE_CASE_	) + 1	)]
        lowerCAmelCase_						,lowerCAmelCase_       :    Tuple								=			get_aligned_output_features_output_indices(
            out_features=SCREAMING_SNAKE_CASE_   ,      out_indices=SCREAMING_SNAKE_CASE_   ,      stage_names=self.stage_names	)





