"""simple docstring"""




from typing import List, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


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

_a				:		List[Any]	   =       {
    'huggingface/time-series-transformer-tourism-monthly': (
        'https://huggingface.co/huggingface/time-series-transformer-tourism-monthly/resolve/main/config.json'
    ),
    # See all TimeSeriesTransformer models at https://huggingface.co/models?filter=time_series_transformer
}
class 						__A							(			SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:      Union[str, Any]		 =		"time_series_transformer"
     _UpperCamelCase							:      Any		 =		{
         "hidden_size": "d_model",
         "num_attention_heads": "encoder_attention_heads",
         "num_hidden_layers": "encoder_layers",
     }






     def __init__(		self    ,					a__ = None    ,					a__ = None    ,					a__ = "student_t"    ,					a__ = "nll"    ,					a__ = 1    ,					a__ = [1, 2, 3, 4, 5, 6, 7]    ,					a__ = "mean"    ,					a__ = 0    ,					a__ = 0    ,					a__ = 0    ,					a__ = 0    ,					a__ = None    ,					a__ = None    ,					a__ = 32    ,					a__ = 32    ,					a__ = 2    ,					a__ = 2    ,					a__ = 2    ,					a__ = 2    ,					a__ = True    ,					a__ = "gelu"    ,					a__ = 64    ,					a__ = 0.1    ,					a__ = 0.1    ,					a__ = 0.1    ,					a__ = 0.1    ,					a__ = 0.1    ,					a__ = 100    ,					a__ = 0.0_2    ,					a__=True    ,					**a__    ,					):
       # time series specific configuration
       _lowerCAmelCase						:	Dict        =					prediction_length
       _lowerCAmelCase						:	Optional[Any]        =					context_length or prediction_length
       _lowerCAmelCase						:	str        =					distribution_output
       _lowerCAmelCase						:	Optional[Any]        =					loss
       _lowerCAmelCase						:	Any        =					input_size
       _lowerCAmelCase						:	int        =					num_time_features
       _lowerCAmelCase						:	List[Any]        =					lags_sequence
       _lowerCAmelCase						:	List[str]        =					scaling
       _lowerCAmelCase						:	Union[str, Any]        =					num_dynamic_real_features
       _lowerCAmelCase						:	Union[str, Any]        =					num_static_real_features
       _lowerCAmelCase						:	List[Any]        =					num_static_categorical_features
       if cardinality and num_static_categorical_features > 0:
         if len(a__  ) != num_static_categorical_features:
           raise ValueError(
               """The cardinality should be a list of the same length as `num_static_categorical_features`"""  )
         _lowerCAmelCase						:	Optional[int]        =					cardinality
       else:
         _lowerCAmelCase						:	Union[str, Any]        =					[0]
       if embedding_dimension and num_static_categorical_features > 0:
         if len(a__  ) != num_static_categorical_features:
           raise ValueError(
               """The embedding dimension should be a list of the same length as `num_static_categorical_features`"""  )
         _lowerCAmelCase						:	Optional[int]        =					embedding_dimension
       else:
         _lowerCAmelCase						:	int        =					[min(50    ,					(cat + 1) // 2  ) for cat in self.cardinality]
       _lowerCAmelCase						:	List[Any]        =					num_parallel_samples

       # Transformer architecture configuration
       _lowerCAmelCase						:	Any        =					input_size * len(a__  ) + self._number_of_features
       _lowerCAmelCase						:	Optional[int]        =					d_model
       _lowerCAmelCase						:	int        =					encoder_attention_heads
       _lowerCAmelCase						:	Tuple        =					decoder_attention_heads
       _lowerCAmelCase						:	Any        =					encoder_ffn_dim
       _lowerCAmelCase						:	List[Any]        =					decoder_ffn_dim
       _lowerCAmelCase						:	Dict        =					encoder_layers
       _lowerCAmelCase						:	List[Any]        =					decoder_layers

       _lowerCAmelCase						:	List[str]        =					dropout
       _lowerCAmelCase						:	Any        =					attention_dropout
       _lowerCAmelCase						:	Union[str, Any]        =					activation_dropout
       _lowerCAmelCase						:	List[str]        =					encoder_layerdrop
       _lowerCAmelCase						:	Dict        =					decoder_layerdrop

       _lowerCAmelCase						:	int        =					activation_function
       _lowerCAmelCase						:	int        =					init_std

       _lowerCAmelCase						:	List[Any]        =					use_cache

       super().__init__(is_encoder_decoder=a__    ,					**a__  )






     @property
     def    __A  (		self  ):
       return (
           sum(self.embedding_dimension  )
           + self.num_dynamic_real_features
           + self.num_time_features
           + self.num_static_real_features
           + self.input_size * 2  # the log1p(abs(loc)) and log(scale) features
       )





"""simple docstring"""




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


_a				:		List[Any]	   =       logging.get_logger(__name__)
class 						__A							(			SCREAMING_SNAKE_CASE_   ,     SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:      Tuple		 =		"maskformer-swin"

     _UpperCamelCase							:      Union[str, Any]		 =		{
         "num_attention_heads": "num_heads",
         "num_hidden_layers": "num_layers",
     }






     def __init__(		self    ,					a__=224    ,					a__=4    ,					a__=3    ,					a__=96    ,					a__=[2, 2, 6, 2]    ,					a__=[3, 6, 12, 24]    ,					a__=7    ,					a__=4.0    ,					a__=True    ,					a__=0.0    ,					a__=0.0    ,					a__=0.1    ,					a__="gelu"    ,					a__=False    ,					a__=0.0_2    ,					a__=1e-5    ,					a__=None    ,					a__=None    ,					**a__    ,					):
       super().__init__(**a__  )

       _lowerCAmelCase						:	Dict        =					image_size
       _lowerCAmelCase						:	List[str]        =					patch_size
       _lowerCAmelCase						:	Any        =					num_channels
       _lowerCAmelCase						:	int        =					embed_dim
       _lowerCAmelCase						:	Optional[Any]        =					depths
       _lowerCAmelCase						:	List[str]        =					len(a__  )
       _lowerCAmelCase						:	List[Any]        =					num_heads
       _lowerCAmelCase						:	Tuple        =					window_size
       _lowerCAmelCase						:	List[Any]        =					mlp_ratio
       _lowerCAmelCase						:	Optional[Any]        =					qkv_bias
       _lowerCAmelCase						:	int        =					hidden_dropout_prob
       _lowerCAmelCase						:	Union[str, Any]        =					attention_probs_dropout_prob
       _lowerCAmelCase						:	Any        =					drop_path_rate
       _lowerCAmelCase						:	Optional[Any]        =					hidden_act
       _lowerCAmelCase						:	Tuple        =					use_absolute_embeddings
       _lowerCAmelCase						:	str        =					layer_norm_eps
       _lowerCAmelCase						:	Any        =					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						:	Union[str, Any]        =					int(embed_dim * 2 ** (len(a__  ) - 1)  )
       _lowerCAmelCase						:	int        =					["""stem"""] + [F"stage{idx}" for idx in range(1    ,					len(a__  ) + 1  )]
       _lowerCAmelCase      ,     _lowerCAmelCase						:	int        =					get_aligned_output_features_output_indices(
           out_features=a__    ,					out_indices=a__    ,					stage_names=self.stage_names  )




