


from dataclasses import dataclass
from typing import Dict, Optional, Tuple, Union

import torch
import torch.nn as nn

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, apply_forward_hook
from .attention_processor import AttentionProcessor, AttnProcessor
from .modeling_utils import ModelMixin
from .vae import Decoder, DecoderOutput, DiagonalGaussianDistribution, Encoder


@dataclass
class      lowercase__	(       lowerCAmelCase__		):
  A__=	42




class      lowercase__	(       lowerCAmelCase__       ,				lowerCAmelCase__		):
  A__=	True






  @register_to_config
  def __init__(       self   :       str		,    _lowercase   :       Any = 3		,    _lowercase   :       List[Any] = 3		,    _lowercase   :       Any = ("DownEncoderBlock2D",)		,    _lowercase   :       Tuple = ("UpDecoderBlock2D",)		,    _lowercase   :       Union[str, Any] = (64,)		,    _lowercase   :       Union[str, Any] = 1		,    _lowercase   :       str = "silu"		,    _lowercase   :       Any = 4		,    _lowercase   :       Dict = 32		,    _lowercase   :       Optional[Any] = 32		,    _lowercase   :       List[str] = 0.1_8_2_1_5		,    ):




         """simple docstring"""







         super().__init__()

         # pass init params to Encoder
         UpperCAmelCase__					    =  Encoder(
             in_channels=__lowerCAmelCase		,    out_channels=__lowerCAmelCase		,    down_block_types=__lowerCAmelCase		,    block_out_channels=__lowerCAmelCase		,    layers_per_block=__lowerCAmelCase		,    act_fn=__lowerCAmelCase		,    norm_num_groups=__lowerCAmelCase		,    double_z=__lowerCAmelCase		,    )

         # pass init params to Decoder
         UpperCAmelCase__					    =  Decoder(
             in_channels=__lowerCAmelCase		,    out_channels=__lowerCAmelCase		,    up_block_types=__lowerCAmelCase		,    block_out_channels=__lowerCAmelCase		,    layers_per_block=__lowerCAmelCase		,    norm_num_groups=__lowerCAmelCase		,    act_fn=__lowerCAmelCase		,    )

         UpperCAmelCase__					    =  nn.Convad(2 * latent_channels		,    2 * latent_channels		,    1			)
         UpperCAmelCase__					    =  nn.Convad(__lowerCAmelCase		,    __lowerCAmelCase		,    1			)

         UpperCAmelCase__					    =  False
         UpperCAmelCase__					    =  False

         # only relevant if vae tiling is enabled
         UpperCAmelCase__					    =  self.config.sample_size
         UpperCAmelCase__					    =  (
             self.config.sample_size[0]
             if isinstance(self.config.sample_size		,    (list, tuple)			)
             else self.config.sample_size
         )
         UpperCAmelCase__					    =  int(sample_size / (2 ** (len(self.config.block_out_channels			) - 1))			)
         UpperCAmelCase__					    =  0.2_5






  def       _UpperCAmelCase	(       self   :       Any		,    _lowercase   :       Union[str, Any]		,    _lowercase   :       Any=False			):




         """simple docstring"""







         if isinstance(__lowerCAmelCase		,    (Encoder, Decoder)			):
                UpperCAmelCase__					    =  value






  def       _UpperCAmelCase	(       self   :       str		,    _lowercase   :       List[Any] = True			):




         """simple docstring"""







         UpperCAmelCase__					    =  use_tiling






  def       _UpperCAmelCase	(       self   :       Tuple			):




         """simple docstring"""







         self.enable_tiling(__lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       int			):




         """simple docstring"""







         UpperCAmelCase__					    =  True






  def       _UpperCAmelCase	(       self   :       List[str]			):




         """simple docstring"""







         UpperCAmelCase__					    =  False






  @property
  # Copied from diffusers.models.unet_2d_condition.UNet2DConditionModel.attn_processors
  def       _UpperCAmelCase	(       self   :       Optional[Any]			):




         """simple docstring"""







         UpperCAmelCase__					    =  {}

         def fn_recursive_add_processors(_lowercase   :       int		,    _lowercase   :       Optional[Any]		,    _lowercase   :       Any			):
                if hasattr(__lowerCAmelCase		,    "set_processor"			):
                       UpperCAmelCase__					    =  module.processor

                for sub_name, child in module.named_children():
                       fn_recursive_add_processors(F"""{name}.{sub_name}"""		,    __lowerCAmelCase		,    __lowerCAmelCase			)

                return processors

         for name, module in self.named_children():
                fn_recursive_add_processors(__lowerCAmelCase		,    __lowerCAmelCase		,    __lowerCAmelCase			)

         return processors






  def       _UpperCAmelCase	(       self   :       str		,    _lowercase   :       int			):




         """simple docstring"""







         UpperCAmelCase__					    =  len(self.attn_processors.keys()			)

         if isinstance(__lowerCAmelCase		,    __lowerCAmelCase			) and len(__lowerCAmelCase			) != count:
                raise ValueError(
                    F"""A dict of processors was passed, but the number of processors {len(__lowerCAmelCase			)} does not match the"""
                    F""" number of attention layers: {count}. Please make sure to pass {count} processor classes."""			)

         def fn_recursive_attn_processor(_lowercase   :       Dict		,    _lowercase   :       Dict		,    _lowercase   :       List[Any]			):
                if hasattr(__lowerCAmelCase		,    "set_processor"			):
                       if not isinstance(__lowerCAmelCase		,    __lowerCAmelCase			):
                              module.set_processor(__lowerCAmelCase			)
                       else:
                              module.set_processor(processor.pop(F"""{name}.processor"""			)			)

                for sub_name, child in module.named_children():
                       fn_recursive_attn_processor(F"""{name}.{sub_name}"""		,    __lowerCAmelCase		,    __lowerCAmelCase			)

         for name, module in self.named_children():
                fn_recursive_attn_processor(__lowerCAmelCase		,    __lowerCAmelCase		,    __lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       Tuple			):




         """simple docstring"""







         self.set_attn_processor(AttnProcessor()			)






  @apply_forward_hook
  def       _UpperCAmelCase	(       self   :       str		,    _lowercase   :       int		,    _lowercase   :       Optional[Any] = True			):




         """simple docstring"""







         if self.use_tiling and (x.shape[-1] > self.tile_sample_min_size or x.shape[-2] > self.tile_sample_min_size):
                return self.tiled_encode(__lowerCAmelCase		,    return_dict=__lowerCAmelCase			)

         if self.use_slicing and x.shape[0] > 1:
                UpperCAmelCase__					    =  [self.encoder(__lowerCAmelCase			) for x_slice in x.split(1			)]
                UpperCAmelCase__					    =  torch.cat(__lowerCAmelCase			)
         else:
                UpperCAmelCase__					    =  self.encoder(__lowerCAmelCase			)

         UpperCAmelCase__					    =  self.quant_conv(__lowerCAmelCase			)
         UpperCAmelCase__					    =  DiagonalGaussianDistribution(__lowerCAmelCase			)

         if not return_dict:
                return (posterior,)

         return AutoencoderKLOutput(latent_dist=__lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       Optional[int]		,    _lowercase   :       int		,    _lowercase   :       Optional[Any] = True			):




         """simple docstring"""







         if self.use_tiling and (z.shape[-1] > self.tile_latent_min_size or z.shape[-2] > self.tile_latent_min_size):
                return self.tiled_decode(__lowerCAmelCase		,    return_dict=__lowerCAmelCase			)

         UpperCAmelCase__					    =  self.post_quant_conv(__lowerCAmelCase			)
         UpperCAmelCase__					    =  self.decoder(__lowerCAmelCase			)

         if not return_dict:
                return (dec,)

         return DecoderOutput(sample=__lowerCAmelCase			)






  @apply_forward_hook
  def       _UpperCAmelCase	(       self   :       Any		,    _lowercase   :       str		,    _lowercase   :       Optional[Any] = True			):




         """simple docstring"""







         if self.use_slicing and z.shape[0] > 1:
                UpperCAmelCase__					    =  [self._decode(__lowerCAmelCase			).sample for z_slice in z.split(1			)]
                UpperCAmelCase__					    =  torch.cat(__lowerCAmelCase			)
         else:
                UpperCAmelCase__					    =  self._decode(__lowerCAmelCase			).sample

         if not return_dict:
                return (decoded,)

         return DecoderOutput(sample=__lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       Optional[int]		,    _lowercase   :       List[str]		,    _lowercase   :       Any		,    _lowercase   :       Optional[int]			):




         """simple docstring"""







         UpperCAmelCase__					    =  min(a.shape[2]		,    b.shape[2]		,    __lowerCAmelCase			)
         for y in range(__lowerCAmelCase			):
                UpperCAmelCase__					    =  a[:, :, -blend_extent + y, :] * (1 - y / blend_extent) + b[:, :, y, :] * (y / blend_extent)
         return b






  def       _UpperCAmelCase	(       self   :       Tuple		,    _lowercase   :       Optional[int]		,    _lowercase   :       Optional[int]		,    _lowercase   :       Optional[Any]			):




         """simple docstring"""







         UpperCAmelCase__					    =  min(a.shape[3]		,    b.shape[3]		,    __lowerCAmelCase			)
         for x in range(__lowerCAmelCase			):
                UpperCAmelCase__					    =  a[:, :, :, -blend_extent + x] * (1 - x / blend_extent) + b[:, :, :, x] * (x / blend_extent)
         return b






  def       _UpperCAmelCase	(       self   :       Union[str, Any]		,    _lowercase   :       List[str]		,    _lowercase   :       Dict = True			):




         """simple docstring"""







         UpperCAmelCase__					    =  int(self.tile_sample_min_size * (1 - self.tile_overlap_factor)			)
         UpperCAmelCase__					    =  int(self.tile_latent_min_size * self.tile_overlap_factor			)
         UpperCAmelCase__					    =  self.tile_latent_min_size - blend_extent

         # Split the image into 512x512 tiles and encode them separately.
         UpperCAmelCase__					    =  []
         for i in range(0		,    x.shape[2]		,    __lowerCAmelCase			):
                UpperCAmelCase__					    =  []
                for j in range(0		,    x.shape[3]		,    __lowerCAmelCase			):
                       UpperCAmelCase__					    =  x[:, :, i : i + self.tile_sample_min_size, j : j + self.tile_sample_min_size]
                       UpperCAmelCase__					    =  self.encoder(__lowerCAmelCase			)
                       UpperCAmelCase__					    =  self.quant_conv(__lowerCAmelCase			)
                       row.append(__lowerCAmelCase			)
                rows.append(__lowerCAmelCase			)
         UpperCAmelCase__					    =  []
         for i, row in enumerate(__lowerCAmelCase			):
                UpperCAmelCase__					    =  []
                for j, tile in enumerate(__lowerCAmelCase			):
                       # blend the above tile and the left tile
                       # to the current tile and add the current tile to the result row
                       if i > 0:
                              UpperCAmelCase__					    =  self.blend_v(rows[i - 1][j]		,    __lowerCAmelCase		,    __lowerCAmelCase			)
                       if j > 0:
                              UpperCAmelCase__					    =  self.blend_h(row[j - 1]		,    __lowerCAmelCase		,    __lowerCAmelCase			)
                       result_row.append(tile[:, :, :row_limit, :row_limit]			)
                result_rows.append(torch.cat(__lowerCAmelCase		,    dim=3			)			)

         UpperCAmelCase__					    =  torch.cat(__lowerCAmelCase		,    dim=2			)
         UpperCAmelCase__					    =  DiagonalGaussianDistribution(__lowerCAmelCase			)

         if not return_dict:
                return (posterior,)

         return AutoencoderKLOutput(latent_dist=__lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       Any		,    _lowercase   :       Optional[int]		,    _lowercase   :       Dict = True			):




         """simple docstring"""







         UpperCAmelCase__					    =  int(self.tile_latent_min_size * (1 - self.tile_overlap_factor)			)
         UpperCAmelCase__					    =  int(self.tile_sample_min_size * self.tile_overlap_factor			)
         UpperCAmelCase__					    =  self.tile_sample_min_size - blend_extent

         # Split z into overlapping 64x64 tiles and decode them separately.
         # The tiles have an overlap to avoid seams between tiles.
         UpperCAmelCase__					    =  []
         for i in range(0		,    z.shape[2]		,    __lowerCAmelCase			):
                UpperCAmelCase__					    =  []
                for j in range(0		,    z.shape[3]		,    __lowerCAmelCase			):
                       UpperCAmelCase__					    =  z[:, :, i : i + self.tile_latent_min_size, j : j + self.tile_latent_min_size]
                       UpperCAmelCase__					    =  self.post_quant_conv(__lowerCAmelCase			)
                       UpperCAmelCase__					    =  self.decoder(__lowerCAmelCase			)
                       row.append(__lowerCAmelCase			)
                rows.append(__lowerCAmelCase			)
         UpperCAmelCase__					    =  []
         for i, row in enumerate(__lowerCAmelCase			):
                UpperCAmelCase__					    =  []
                for j, tile in enumerate(__lowerCAmelCase			):
                       # blend the above tile and the left tile
                       # to the current tile and add the current tile to the result row
                       if i > 0:
                              UpperCAmelCase__					    =  self.blend_v(rows[i - 1][j]		,    __lowerCAmelCase		,    __lowerCAmelCase			)
                       if j > 0:
                              UpperCAmelCase__					    =  self.blend_h(row[j - 1]		,    __lowerCAmelCase		,    __lowerCAmelCase			)
                       result_row.append(tile[:, :, :row_limit, :row_limit]			)
                result_rows.append(torch.cat(__lowerCAmelCase		,    dim=3			)			)

         UpperCAmelCase__					    =  torch.cat(__lowerCAmelCase		,    dim=2			)
         if not return_dict:
                return (dec,)

         return DecoderOutput(sample=__lowerCAmelCase			)






  def       _UpperCAmelCase	(       self   :       Union[str, Any]		,    _lowercase   :       Tuple		,    _lowercase   :       Tuple = False		,    _lowercase   :       Any = True		,    _lowercase   :       Optional[int] = None		,    ):




         """simple docstring"""







         UpperCAmelCase__					    =  sample
         UpperCAmelCase__					    =  self.encode(__lowerCAmelCase			).latent_dist
         if sample_posterior:
                UpperCAmelCase__					    =  posterior.sample(generator=__lowerCAmelCase			)
         else:
                UpperCAmelCase__					    =  posterior.mode()
         UpperCAmelCase__					    =  self.decode(__lowerCAmelCase			).sample

         if not return_dict:
                return (dec,)

         return DecoderOutput(sample=__lowerCAmelCase			)






'''simple docstring'''




import warnings
from typing import Any, Dict, List, Optional, Union

import numpy as np

from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging


__lowercase        =    logging.get_logger(__name__)






class 							a__(   lowerCAmelCase__      ):


			'''simple docstring'''






			UpperCAmelCase_     :	Dict						=			['''input_values''', '''attention_mask''']



			def __init__(  self			,       __lowerCAmelCase = 1			,       __lowerCAmelCase = 16000			,       __lowerCAmelCase = 0.0			,       __lowerCAmelCase = False			,       __lowerCAmelCase = 80			,       __lowerCAmelCase = 16			,       __lowerCAmelCase = 64			,       __lowerCAmelCase = "hann_window"			,       __lowerCAmelCase = 1.0			,       __lowerCAmelCase = 80			,       __lowerCAmelCase = 7600			,       __lowerCAmelCase = 1E-1_0			,       __lowerCAmelCase = 2			,       __lowerCAmelCase = True			,       **__lowerCAmelCase			,       ):




					"""simple docstring"""


					super().__init__(feature_size=__lowerCAmelCase			,       sampling_rate=__lowerCAmelCase			,       padding_value=__lowerCAmelCase			,       **__lowerCAmelCase)
					lowerCAmelCase     =    do_normalize
					lowerCAmelCase     =    return_attention_mask

					lowerCAmelCase     =    num_mel_bins
					lowerCAmelCase     =    hop_length
					lowerCAmelCase     =    win_length
					lowerCAmelCase     =    win_function
					lowerCAmelCase     =    frame_signal_scale
					lowerCAmelCase     =    fmin
					lowerCAmelCase     =    fmax
					lowerCAmelCase     =    mel_floor
					lowerCAmelCase     =    reduction_factor

					lowerCAmelCase     =    win_length * sampling_rate // 1000
					lowerCAmelCase     =    hop_length * sampling_rate // 1000
					lowerCAmelCase     =    optimal_fft_length(self.sample_size)
					lowerCAmelCase     =    (self.n_fft // 2) + 1

					lowerCAmelCase     =    window_function(window_length=self.sample_size			,       name=self.win_function			,       periodic=__lowerCAmelCase)

					lowerCAmelCase     =    mel_filter_bank(
					    num_frequency_bins=self.n_freqs			,       num_mel_filters=self.num_mel_bins			,       min_frequency=self.fmin			,       max_frequency=self.fmax			,       sampling_rate=self.sampling_rate			,       norm="""slaney"""			,       mel_scale="""slaney"""			,       )

					if frame_signal_scale != 1.0:
							warnings.warn(
							    """The argument `frame_signal_scale` is deprecated and will be removed in version 4.30.0 of Transformers"""			,       __lowerCAmelCase			,       )
					if reduction_factor != 2.0:
							warnings.warn(
							    """The argument `reduction_factor` is deprecated and will be removed in version 4.30.0 of Transformers"""			,       __lowerCAmelCase			,       )



			@staticmethod
			# Copied from transformers.models.wav2vec2.feature_extraction_wav2vec2.Wav2Vec2FeatureExtractor.zero_mean_unit_var_norm
			def 				a_			(  __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase = 0.0):




					"""simple docstring"""


					if attention_mask is not None:
							lowerCAmelCase     =    np.array(__lowerCAmelCase			,       np.intaa)
							lowerCAmelCase     =    []

							for vector, length in zip(__lowerCAmelCase			,       attention_mask.sum(-1)):
									lowerCAmelCase     =    (vector - vector[:length].mean()) / np.sqrt(vector[:length].var() + 1E-7)
									if length < normed_slice.shape[0]:
											lowerCAmelCase     =    padding_value

									normed_input_values.append(__lowerCAmelCase)
					else:
							lowerCAmelCase     =    [(x - x.mean()) / np.sqrt(x.var() + 1E-7) for x in input_values]

					return normed_input_values



			def 				a_			(  self			,       __lowerCAmelCase			,       ):




					"""simple docstring"""


					lowerCAmelCase     =    spectrogram(
					    __lowerCAmelCase			,       window=self.window			,       frame_length=self.sample_size			,       hop_length=self.sample_stride			,       fft_length=self.n_fft			,       mel_filters=self.mel_filters			,       mel_floor=self.mel_floor			,       log_mel="""log10"""			,       )
					return log_mel_spec.T



			def __call__(  self			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       __lowerCAmelCase = False			,       __lowerCAmelCase = None			,       __lowerCAmelCase = False			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       **__lowerCAmelCase			,       ):




					"""simple docstring"""


					if audio is None and audio_target is None:
							raise ValueError("""You must provide either `audio` or `audio_target` values.""")

					if sampling_rate is not None:
							if sampling_rate != self.sampling_rate:
									raise ValueError(
									    f"The model corresponding to this feature extractor: {self} was trained using a sampling rate of"
									    f" {self.sampling_rate}. Please make sure that the provided audio input was sampled with"
									    f" {self.sampling_rate} and not {sampling_rate}.")
					else:
							logger.warning(
							    """It is strongly recommended to pass the ``sampling_rate`` argument to this function. """
							    """Failing to do so can result in silent errors that might be hard to debug.""")

					if audio is not None:
							lowerCAmelCase     =    self._process_audio(
							    __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       **__lowerCAmelCase			,       )
					else:
							lowerCAmelCase     =    None

					if audio_target is not None:
							lowerCAmelCase     =    self._process_audio(
							    __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       __lowerCAmelCase			,       **__lowerCAmelCase			,       )

							if inputs is None:
									return inputs_target
							else:
									lowerCAmelCase     =    inputs_target["""input_values"""]
									lowerCAmelCase     =    inputs_target.get("""attention_mask""")
									if decoder_attention_mask is not None:
											lowerCAmelCase     =    decoder_attention_mask

					return inputs



			def 				a_			(  self			,       __lowerCAmelCase			,       __lowerCAmelCase = False			,       __lowerCAmelCase = False			,       __lowerCAmelCase = None			,       __lowerCAmelCase = False			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       __lowerCAmelCase = None			,       **__lowerCAmelCase			,       ):




					"""simple docstring"""


					lowerCAmelCase     =    isinstance(__lowerCAmelCase			,       np.ndarray) and len(speech.shape) > 1
					if is_batched_numpy and len(speech.shape) > 2:
							raise ValueError(f"Only mono-channel audio is supported for input to {self}")
					lowerCAmelCase     =    is_batched_numpy or (
					    isinstance(__lowerCAmelCase			,       (list, tuple)) and (isinstance(speech[0]			,       (np.ndarray, tuple, list)))
					)

					if is_batched:
							lowerCAmelCase     =    [np.asarray(__lowerCAmelCase			,       dtype=np.floataa) for speech in speech]
					elif not is_batched and not isinstance(__lowerCAmelCase			,       np.ndarray):
							lowerCAmelCase     =    np.asarray(__lowerCAmelCase			,       dtype=np.floataa)
					elif isinstance(__lowerCAmelCase			,       np.ndarray) and speech.dtype is np.dtype(np.floataa):
							lowerCAmelCase     =    speech.astype(np.floataa)

					# always return batch
					if not is_batched:
							lowerCAmelCase     =    [speech]

					# needed to make pad() work on spectrogram inputs
					lowerCAmelCase     =    self.feature_size

					# convert into correct format for padding
					if is_target:
							lowerCAmelCase     =    [self._extract_mel_features(__lowerCAmelCase) for waveform in speech]
							lowerCAmelCase     =    BatchFeature({"""input_values""": features})
							lowerCAmelCase     =    self.num_mel_bins
					else:
							lowerCAmelCase     =    BatchFeature({"""input_values""": speech})

					lowerCAmelCase     =    self.pad(
					    __lowerCAmelCase			,       padding=__lowerCAmelCase			,       max_length=__lowerCAmelCase			,       truncation=__lowerCAmelCase			,       pad_to_multiple_of=__lowerCAmelCase			,       return_attention_mask=__lowerCAmelCase			,       **__lowerCAmelCase			,       )

					lowerCAmelCase     =    feature_size_hack

					# convert input values to correct format
					lowerCAmelCase     =    padded_inputs["""input_values"""]
					if not isinstance(input_values[0]			,       np.ndarray):
							lowerCAmelCase     =    [np.asarray(__lowerCAmelCase			,       dtype=np.floataa) for array in input_values]
					elif (
					    not isinstance(__lowerCAmelCase			,       np.ndarray)
					    and isinstance(input_values[0]			,       np.ndarray)
					    and input_values[0].dtype is np.dtype(np.floataa)
					):
							lowerCAmelCase     =    [array.astype(np.floataa) for array in input_values]
					elif isinstance(__lowerCAmelCase			,       np.ndarray) and input_values.dtype is np.dtype(np.floataa):
							lowerCAmelCase     =    input_values.astype(np.floataa)

					# convert attention_mask to correct format
					lowerCAmelCase     =    padded_inputs.get("""attention_mask""")
					if attention_mask is not None:
							lowerCAmelCase     =    [np.asarray(__lowerCAmelCase			,       dtype=np.intaa) for array in attention_mask]

					# zero-mean and unit-variance normalization
					if not is_target and self.do_normalize:
							lowerCAmelCase     =    (
							    attention_mask
							    if self._get_padding_strategies(__lowerCAmelCase			,       max_length=__lowerCAmelCase) is not PaddingStrategy.DO_NOT_PAD
							    else None
							)
							lowerCAmelCase     =    self.zero_mean_unit_var_norm(
							    padded_inputs["""input_values"""]			,       attention_mask=__lowerCAmelCase			,       padding_value=self.padding_value)

					if return_tensors is not None:
							lowerCAmelCase     =    padded_inputs.convert_to_tensors(__lowerCAmelCase)

					return padded_inputs







			def 				a_			(  self):




					"""simple docstring"""


					lowerCAmelCase     =    super().to_dict()

					# Don't serialize these as they are derived from the other properties.
					lowerCAmelCase     =    ["""window""", """mel_filters""", """sample_size""", """sample_stride""", """n_fft""", """n_freqs"""]
					for name in names:
							if name in output:
									del output[name]

					return output




