'''simple docstring'''




import inspect
import unittest

from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
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
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import (
      MODEL_MAPPING,
      SegformerForImageClassification,
      SegformerForSemanticSegmentation,
      SegformerModel,
  )
  from transformers.models.segformer.modeling_segformer import SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
  from PIL import Image

  from transformers import SegformerImageProcessor




class   a__				(       UpperCAmelCase__			):






     def        SCREAMING_SNAKE_CASE__       (			self		:		str   ):





         """simple docstring"""



         __lowerCamelCase          =  self.config_class(**self.inputs_dict   )
         self.parent.assertTrue(hasattr(a  ,    '''hidden_sizes'''   )   )
         self.parent.assertTrue(hasattr(a  ,    '''num_attention_heads'''   )   )
         self.parent.assertTrue(hasattr(a  ,    '''num_encoder_blocks'''   )   )




class   a__				:






     def __init__(			self		:		Any  ,    a		:		List[str]  ,    a		:		Dict=13  ,    a		:		str=64  ,    a		:		List[Any]=3  ,    a		:		int=4  ,    a		:		Union[str, Any]=[2, 2, 2, 2]  ,    a		:		Optional[Any]=[8, 4, 2, 1]  ,    a		:		Tuple=[16, 32, 64, 1_28]  ,    a		:		Optional[Any]=[1, 4, 8, 16]  ,    a		:		Dict=[1, 2, 4, 8]  ,    a		:		List[str]=True  ,    a		:		Tuple=True  ,    a		:		Optional[int]="gelu"  ,    a		:		str=0.1  ,    a		:		Dict=0.1  ,    a		:		Optional[Any]=0.02  ,    a		:		List[str]=3  ,    a		:		int=None  ,    ):





         """simple docstring"""



         __lowerCamelCase          =  parent
         __lowerCamelCase          =  batch_size
         __lowerCamelCase          =  image_size
         __lowerCamelCase          =  num_channels
         __lowerCamelCase          =  num_encoder_blocks
         __lowerCamelCase          =  sr_ratios
         __lowerCamelCase          =  depths
         __lowerCamelCase          =  hidden_sizes
         __lowerCamelCase          =  downsampling_rates
         __lowerCamelCase          =  num_attention_heads
         __lowerCamelCase          =  is_training
         __lowerCamelCase          =  use_labels
         __lowerCamelCase          =  hidden_act
         __lowerCamelCase          =  hidden_dropout_prob
         __lowerCamelCase          =  attention_probs_dropout_prob
         __lowerCamelCase          =  initializer_range
         __lowerCamelCase          =  num_labels
         __lowerCamelCase          =  scope






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]   )

         __lowerCamelCase          =  None
         if self.use_labels:
             __lowerCamelCase          =  ids_tensor([self.batch_size, self.image_size, self.image_size]  ,    self.num_labels   )

         __lowerCamelCase          =  self.get_config()
         return config, pixel_values, labels






     def        SCREAMING_SNAKE_CASE__       (			self		:		str   ):





         """simple docstring"""



         return SegformerConfig(
             image_size=self.image_size  ,    num_channels=self.num_channels  ,    num_encoder_blocks=self.num_encoder_blocks  ,    depths=self.depths  ,    hidden_sizes=self.hidden_sizes  ,    num_attention_heads=self.num_attention_heads  ,    hidden_act=self.hidden_act  ,    hidden_dropout_prob=self.hidden_dropout_prob  ,    attention_probs_dropout_prob=self.attention_probs_dropout_prob  ,    initializer_range=self.initializer_range  ,    )






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]  ,    a		:		Optional[Any]  ,    a		:		Any  ,    a		:		List[str]   ):





         """simple docstring"""



         __lowerCamelCase          =  SegformerModel(config=a   )
         model.to(a   )
         model.eval()
         __lowerCamelCase          =  model(a   )
         __lowerCamelCase          =  __lowerCamelCase          =  self.image_size // (self.downsampling_rates[-1] * 2)
         self.parent.assertEqual(
             result.last_hidden_state.shape  ,    (self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[int]  ,    a		:		List[str]  ,    a		:		Optional[Any]  ,    a		:		Dict   ):





         """simple docstring"""



         __lowerCamelCase          =  self.num_labels
         __lowerCamelCase          =  SegformerForSemanticSegmentation(a   )
         model.to(a   )
         model.eval()
         __lowerCamelCase          =  model(a   )
         self.parent.assertEqual(
             result.logits.shape  ,    (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)   )
         __lowerCamelCase          =  model(a  ,    labels=a   )
         self.parent.assertEqual(
             result.logits.shape  ,    (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)   )
         self.parent.assertGreater(result.loss  ,    0.0   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Union[str, Any]  ,    a		:		Dict  ,    a		:		int  ,    a		:		Optional[Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  1
         __lowerCamelCase          =  SegformerForSemanticSegmentation(config=a   )
         model.to(a   )
         model.eval()
         __lowerCamelCase          =  torch.randint(0  ,    1  ,    (self.batch_size, self.image_size, self.image_size)   ).to(a   )
         __lowerCamelCase          =  model(a  ,    labels=a   )
         self.parent.assertGreater(result.loss  ,    0.0   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Union[str, Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  self.prepare_config_and_inputs()
         __lowerCamelCase     ,  __lowerCamelCase     ,  __lowerCamelCase          =  config_and_inputs
         __lowerCamelCase          =  {'''pixel_values''': pixel_values}
         return config, inputs_dict




@require_torch
class   a__				(       UpperCAmelCase__							,       UpperCAmelCase__							,       unittest.TestCase			):
     lowerCamelCase  :					Optional[int]							=(
         (
             SegformerModel,
             SegformerForSemanticSegmentation,
             SegformerForImageClassification,
         )
         if is_torch_available()
         else ()
     )
     lowerCamelCase  :					Optional[Any]							=(
         {
             "feature-extraction": SegformerModel,
             "image-classification": SegformerForImageClassification,
             "image-segmentation": SegformerForSemanticSegmentation,
         }
         if is_torch_available()
         else {}
     )

     lowerCamelCase  :					List[Any]							=True
     lowerCamelCase  :					Union[str, Any]							=False
     lowerCamelCase  :					Optional[Any]							=False
     lowerCamelCase  :					Tuple							=False






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]   ):





         """simple docstring"""



         __lowerCamelCase          =  SegformerModelTester(self   )
         __lowerCamelCase          =  SegformerConfigTester(self  ,    config_class=a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Tuple   ):





         """simple docstring"""



         self.config_tester.run_common_tests()






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Dict   ):





         """simple docstring"""



         __lowerCamelCase          =  self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_binary_image_segmentation(*a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[str]   ):





         """simple docstring"""



         __lowerCamelCase          =  self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_image_segmentation(*a   )






     @unittest.skip('''SegFormer does not use inputs_embeds'''   )
     def        SCREAMING_SNAKE_CASE__       (			self		:		int   ):





         """simple docstring"""



         pass






     @unittest.skip('''SegFormer does not have get_input_embeddings method and get_output_embeddings methods'''   )
     def        SCREAMING_SNAKE_CASE__       (			self		:		str   ):





         """simple docstring"""



         pass






     def        SCREAMING_SNAKE_CASE__       (			self		:		List[Any]   ):





         """simple docstring"""



         __lowerCamelCase     ,  __lowerCamelCase          =  self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
             __lowerCamelCase          =  model_class(a   )
             __lowerCamelCase          =  inspect.signature(model.forward   )
             # signature.parameters is an OrderedDict => so arg_names order is deterministic
             __lowerCamelCase          =  [*signature.parameters.keys()]

             __lowerCamelCase          =  ['''pixel_values''']
             self.assertListEqual(arg_names[:1]  ,    a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		int   ):





         """simple docstring"""



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

         for model_class in self.all_model_classes:
             __lowerCamelCase          =  True
             __lowerCamelCase          =  False
             __lowerCamelCase          =  True
             __lowerCamelCase          =  model_class(a   )
             model.to(a   )
             model.eval()
             with torch.no_grad():
                 __lowerCamelCase          =  model(**self._prepare_for_class(a  ,    a   )   )
             __lowerCamelCase          =  outputs.attentions

             __lowerCamelCase          =  sum(self.model_tester.depths   )
             self.assertEqual(len(a   )  ,    a   )

             # check that output_attentions also work using config
             del inputs_dict["output_attentions"]
             __lowerCamelCase          =  True
             __lowerCamelCase          =  model_class(a   )
             model.to(a   )
             model.eval()
             with torch.no_grad():
                 __lowerCamelCase          =  model(**self._prepare_for_class(a  ,    a   )   )
             __lowerCamelCase          =  outputs.attentions

             self.assertEqual(len(a   )  ,    a   )

             # verify the first attentions (first block, first layer)
             __lowerCamelCase          =  (self.model_tester.image_size // 4) ** 2
             __lowerCamelCase          =  (self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
             self.assertListEqual(
                 list(attentions[0].shape[-3:]   )  ,    [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]  ,    )

             # verify the last attentions (last block, last layer)
             __lowerCamelCase          =  (self.model_tester.image_size // 32) ** 2
             __lowerCamelCase          =  (self.model_tester.image_size // (32 * self.model_tester.sr_ratios[-1])) ** 2
             self.assertListEqual(
                 list(attentions[-1].shape[-3:]   )  ,    [self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len]  ,    )
             __lowerCamelCase          =  len(a   )

             # Check attention is always last and order is fine
             __lowerCamelCase          =  True
             __lowerCamelCase          =  True
             __lowerCamelCase          =  model_class(a   )
             model.to(a   )
             model.eval()
             with torch.no_grad():
                 __lowerCamelCase          =  model(**self._prepare_for_class(a  ,    a   )   )

             self.assertEqual(out_len + 1  ,    len(a   )   )

             __lowerCamelCase          =  outputs.attentions

             self.assertEqual(len(a   )  ,    a   )
             # verify the first attentions (first block, first layer)
             __lowerCamelCase          =  (self.model_tester.image_size // 4) ** 2
             __lowerCamelCase          =  (self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
             self.assertListEqual(
                 list(self_attentions[0].shape[-3:]   )  ,    [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]  ,    )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Optional[Any]   ):





         """simple docstring"""



         def check_hidden_states_output(a		:		List[Any]  ,    a		:		List[str]  ,    a		:		Tuple   ):
             __lowerCamelCase          =  model_class(a   )
             model.to(a   )
             model.eval()

             with torch.no_grad():
                 __lowerCamelCase          =  model(**self._prepare_for_class(a  ,    a   )   )

             __lowerCamelCase          =  outputs.hidden_states

             __lowerCamelCase          =  self.model_tester.num_encoder_blocks
             self.assertEqual(len(a   )  ,    a   )

             # verify the first hidden states (first block)
             self.assertListEqual(
                 list(hidden_states[0].shape[-3:]   )  ,    [
                     self.model_tester.hidden_sizes[0],
                     self.model_tester.image_size // 4,
                     self.model_tester.image_size // 4,
                 ]  ,    )

         __lowerCamelCase     ,  __lowerCamelCase          =  self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
             __lowerCamelCase          =  True
             check_hidden_states_output(a  ,    a  ,    a   )

             # check that output_hidden_states also work using config
             del inputs_dict["output_hidden_states"]
             __lowerCamelCase          =  True

             check_hidden_states_output(a  ,    a  ,    a   )






     def        SCREAMING_SNAKE_CASE__       (			self		:		Any   ):





         """simple docstring"""



         if not self.model_tester.is_training:
             return

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

         for model_class in self.all_model_classes:
             if model_class in get_values(a   ):
                 continue

             __lowerCamelCase          =  model_class(a   )
             model.to(a   )
             model.train()
             __lowerCamelCase          =  self._prepare_for_class(a  ,    a  ,    return_labels=a   )
             __lowerCamelCase          =  model(**a   ).loss
             loss.backward()






     @unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''   )
     def        SCREAMING_SNAKE_CASE__       (			self		:		List[Any]   ):





         """simple docstring"""



         pass






     @slow
     def        SCREAMING_SNAKE_CASE__       (			self		:		str   ):





         """simple docstring"""



         for model_name in SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
             __lowerCamelCase          =  SegformerModel.from_pretrained(a   )
             self.assertIsNotNone(a   )






def __lowerCAmelCase			(							)     ->   Union[str, Any]:
    __lowerCamelCase          =  Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''    )
    return image




@require_torch
class   a__				(       unittest.TestCase			):






     @slow
     def        SCREAMING_SNAKE_CASE__       (			self		:		Dict   ):





         """simple docstring"""



         __lowerCamelCase          =  SegformerImageProcessor(
             image_scale=(5_12, 5_12)  ,    keep_ratio=a  ,    align=a  ,    do_random_crop=a   )
         __lowerCamelCase          =  SegformerForSemanticSegmentation.from_pretrained('''nvidia/segformer-b0-finetuned-ade-512-512'''   ).to(
             a   )

         __lowerCamelCase          =  prepare_img()
         __lowerCamelCase          =  image_processor(images=a  ,    return_tensors='''pt'''   )
         __lowerCamelCase          =  encoded_inputs.pixel_values.to(a   )

         with torch.no_grad():
             __lowerCamelCase          =  model(a   )

         __lowerCamelCase          =  torch.Size((1, model.config.num_labels, 1_28, 1_28)   )
         self.assertEqual(outputs.logits.shape  ,    a   )

         __lowerCamelCase          =  torch.tensor(
             [
                 [[-4.63_10, -5.52_32, -6.23_56], [-5.19_21, -6.14_44, -6.59_96], [-5.44_24, -6.27_90, -6.75_74]],
                 [[-12.13_91, -13.31_22, -13.95_54], [-12.87_32, -13.93_52, -14.35_63], [-12.94_38, -13.82_26, -14.25_13]],
                 [[-12.51_34, -13.46_86, -14.49_15], [-12.86_69, -14.43_43, -14.77_58], [-13.25_23, -14.58_19, -15.06_94]],
             ]   ).to(a   )
         self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]  ,    a  ,    atol=1e-4   )   )






     @slow
     def        SCREAMING_SNAKE_CASE__       (			self		:		Union[str, Any]   ):





         """simple docstring"""



         __lowerCamelCase          =  SegformerImageProcessor(
             image_scale=(5_12, 5_12)  ,    keep_ratio=a  ,    align=a  ,    do_random_crop=a   )
         __lowerCamelCase          =  SegformerForSemanticSegmentation.from_pretrained(
             '''nvidia/segformer-b1-finetuned-cityscapes-1024-1024'''   ).to(a   )

         __lowerCamelCase          =  prepare_img()
         __lowerCamelCase          =  image_processor(images=a  ,    return_tensors='''pt'''   )
         __lowerCamelCase          =  encoded_inputs.pixel_values.to(a   )

         with torch.no_grad():
             __lowerCamelCase          =  model(a   )

         __lowerCamelCase          =  torch.Size((1, model.config.num_labels, 1_28, 1_28)   )
         self.assertEqual(outputs.logits.shape  ,    a   )

         __lowerCamelCase          =  torch.tensor(
             [
                 [[-13.57_48, -13.91_11, -12.65_00], [-14.35_00, -15.36_83, -14.23_28], [-14.75_32, -16.04_24, -15.60_87]],
                 [[-17.16_51, -15.87_25, -12.96_53], [-17.25_80, -17.37_18, -14.82_23], [-16.60_58, -16.87_83, -16.74_52]],
                 [[-3.64_56, -3.02_09, -1.42_03], [-3.07_97, -3.19_59, -2.00_00], [-1.87_57, -1.92_17, -1.69_97]],
             ]   ).to(a   )
         self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3]  ,    a  ,    atol=1e-1   )   )






     @slow
     def        SCREAMING_SNAKE_CASE__       (			self		:		int   ):





         """simple docstring"""



         __lowerCamelCase          =  SegformerImageProcessor(
             image_scale=(5_12, 5_12)  ,    keep_ratio=a  ,    align=a  ,    do_random_crop=a   )
         __lowerCamelCase          =  SegformerForSemanticSegmentation.from_pretrained('''nvidia/segformer-b0-finetuned-ade-512-512'''   ).to(
             a   )

         __lowerCamelCase          =  prepare_img()
         __lowerCamelCase          =  image_processor(images=a  ,    return_tensors='''pt'''   )
         __lowerCamelCase          =  encoded_inputs.pixel_values.to(a   )

         with torch.no_grad():
             __lowerCamelCase          =  model(a   )

         __lowerCamelCase          =  outputs.logits.detach().cpu()

         __lowerCamelCase          =  image_processor.post_process_semantic_segmentation(outputs=a  ,    target_sizes=[(5_00, 3_00)]   )
         __lowerCamelCase          =  torch.Size((5_00, 3_00)   )
         self.assertEqual(segmentation[0].shape  ,    a   )

         __lowerCamelCase          =  image_processor.post_process_semantic_segmentation(outputs=a   )
         __lowerCamelCase          =  torch.Size((1_28, 1_28)   )
         self.assertEqual(segmentation[0].shape  ,    a   )

'''simple docstring'''




import functools
import operator

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


__UpperCAmelCase												=logging.get_logger(__name__)

__UpperCAmelCase												={
    "microsoft/unispeech-sat-base-100h-libri-ft": (
        "https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}




class    a__				(       UpperCAmelCase__			):
     lowerCamelCase  :					List[Any]							="unispeech-sat"






     def __init__(			self		:		Dict  ,    a		:		str=32  ,    a		:		Any=7_68  ,    a		:		Optional[Any]=12  ,    a		:		Optional[int]=12  ,    a		:		int=30_72  ,    a		:		int="gelu"  ,    a		:		Dict=0.1  ,    a		:		Dict=0.1  ,    a		:		List[Any]=0.1  ,    a		:		Tuple=0.0  ,    a		:		Optional[Any]=0.0  ,    a		:		Tuple=0.1  ,    a		:		List[Any]=0.1  ,    a		:		str=0.02  ,    a		:		List[Any]=1e-5  ,    a		:		int="group"  ,    a		:		Union[str, Any]="gelu"  ,    a		:		Optional[int]=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)  ,    a		:		List[Any]=(5, 2, 2, 2, 2, 2, 2)  ,    a		:		int=(10, 3, 3, 3, 3, 2, 2)  ,    a		:		Optional[Any]=False  ,    a		:		Any=1_28  ,    a		:		Tuple=16  ,    a		:		str=False  ,    a		:		Optional[Any]=True  ,    a		:		Dict=0.05  ,    a		:		List[Any]=10  ,    a		:		Any=2  ,    a		:		Optional[Any]=0.0  ,    a		:		Optional[Any]=10  ,    a		:		Any=0  ,    a		:		Any=3_20  ,    a		:		str=2  ,    a		:		List[str]=0.1  ,    a		:		List[str]=1_00  ,    a		:		List[str]=2_56  ,    a		:		str=2_56  ,    a		:		Dict=0.1  ,    a		:		Optional[Any]="mean"  ,    a		:		str=False  ,    a		:		Tuple=False  ,    a		:		Optional[Any]=2_56  ,    a		:		int=(5_12, 5_12, 5_12, 5_12, 15_00)  ,    a		:		int=(5, 3, 3, 1, 1)  ,    a		:		Any=(1, 2, 3, 1, 1)  ,    a		:		Union[str, Any]=5_12  ,    a		:		Optional[int]=0  ,    a		:		Optional[int]=1  ,    a		:		Optional[int]=2  ,    a		:		int=5_04  ,    **a		:		Dict  ,    ):





         """simple docstring"""



         super().__init__(**a  ,    pad_token_id=a  ,    bos_token_id=a  ,    eos_token_id=a   )
         __lowerCamelCase          =  hidden_size
         __lowerCamelCase          =  feat_extract_norm
         __lowerCamelCase          =  feat_extract_activation
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  conv_bias
         __lowerCamelCase          =  num_conv_pos_embeddings
         __lowerCamelCase          =  num_conv_pos_embedding_groups
         __lowerCamelCase          =  len(self.conv_dim   )
         __lowerCamelCase          =  num_hidden_layers
         __lowerCamelCase          =  intermediate_size
         __lowerCamelCase          =  hidden_act
         __lowerCamelCase          =  num_attention_heads
         __lowerCamelCase          =  hidden_dropout
         __lowerCamelCase          =  attention_dropout
         __lowerCamelCase          =  activation_dropout
         __lowerCamelCase          =  feat_proj_dropout
         __lowerCamelCase          =  final_dropout
         __lowerCamelCase          =  layerdrop
         __lowerCamelCase          =  layer_norm_eps
         __lowerCamelCase          =  initializer_range
         __lowerCamelCase          =  vocab_size
         __lowerCamelCase          =  num_clusters
         __lowerCamelCase          =  do_stable_layer_norm
         __lowerCamelCase          =  use_weighted_layer_sum

         if (
             (len(self.conv_stride   ) != self.num_feat_extract_layers)
             or (len(self.conv_kernel   ) != self.num_feat_extract_layers)
             or (len(self.conv_dim   ) != self.num_feat_extract_layers)
         ):
             raise ValueError(
                 '''Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =='''
                 ''' `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ='''
                 f""" {len(self.conv_dim   )}`, `len(config.conv_stride) = {len(self.conv_stride   )}`,"""
                 f""" `len(config.conv_kernel) = {len(self.conv_kernel   )}`."""   )

         # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
         __lowerCamelCase          =  apply_spec_augment
         __lowerCamelCase          =  mask_time_prob
         __lowerCamelCase          =  mask_time_length
         __lowerCamelCase          =  mask_time_min_masks
         __lowerCamelCase          =  mask_feature_prob
         __lowerCamelCase          =  mask_feature_length
         __lowerCamelCase          =  mask_feature_min_masks

         # parameters for pretraining with codevector quantized representations
         __lowerCamelCase          =  num_codevectors_per_group
         __lowerCamelCase          =  num_codevector_groups
         __lowerCamelCase          =  contrastive_logits_temperature
         __lowerCamelCase          =  feat_quantizer_dropout
         __lowerCamelCase          =  num_negatives
         __lowerCamelCase          =  codevector_dim
         __lowerCamelCase          =  proj_codevector_dim
         __lowerCamelCase          =  diversity_loss_weight

         # ctc loss
         __lowerCamelCase          =  ctc_loss_reduction
         __lowerCamelCase          =  ctc_zero_infinity

         # SequenceClassification-specific parameter. Feel free to ignore for other classes.
         __lowerCamelCase          =  classifier_proj_size

         # XVector-specific parameters. Feel free to ignore for other classes.
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  list(a   )
         __lowerCamelCase          =  xvector_output_dim






     @property
     def        SCREAMING_SNAKE_CASE__       (			self		:		Any   ):





         """simple docstring"""



         return functools.reduce(operator.mul  ,    self.conv_stride  ,    1   )
