




from typing import List, Optional, Union

import numpy as np

from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging


UpperCamelCase__						=		logging.get_logger(__name__)


class 							__SCREAMING_SNAKE_CASE				(						lowerCamelCase    ):
					_lowerCamelCase						    =					["""input_values""", """attention_mask"""]

					def __init__(							self					,			__lowercase=1					,			__lowercase=16_000					,			__lowercase=0.0					,			__lowercase=False					,			__lowercase=True					,			**__lowercase					,			):







						'''simple docstring'''




						super().__init__(feature_size=__lowercase					,			sampling_rate=__lowercase					,			padding_value=__lowercase					,			**__lowercase   )
						lowerCamelCase_				:						Union[str, Any]				  =				return_attention_mask
						lowerCamelCase_				:						List[Any]				  =				do_normalize

					@staticmethod
					def       lowercase_				(							__lowercase					,			__lowercase					,			__lowercase = 0.0   ):







						'''simple docstring'''




						if attention_mask is not None:
							lowerCamelCase_				:						Union[str, Any]				  =				np.array(__lowercase					,			np.intaa   )
							lowerCamelCase_				:						str				  =				[]

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

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

						return normed_input_values





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







						'''simple docstring'''




						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 `raw_speech` 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.'   )

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

						# always return batch
						if not is_batched:
							lowerCamelCase_				:						List[Any]				  =				[raw_speech]

						# convert into correct format for padding
						lowerCamelCase_				:						str				  =				BatchFeature({'input_values': raw_speech}   )

						lowerCamelCase_				:						str				  =				self.pad(
						    __lowercase					,			padding=__lowercase					,			max_length=__lowercase					,			truncation=__lowercase					,			pad_to_multiple_of=__lowercase					,			return_attention_mask=__lowercase					,			)

						# convert input values to correct format
						lowerCamelCase_				:						Tuple				  =				padded_inputs['input_values']
						if not isinstance(input_values[0]					,			np.ndarray   ):
							lowerCamelCase_				:						List[str]				  =				[np.asarray(__lowercase					,			dtype=np.floataa   ) for array in input_values]
						elif (
						    not isinstance(__lowercase					,			np.ndarray   )
						    and isinstance(input_values[0]					,			np.ndarray   )
						    and input_values[0].dtype is np.dtype(np.floataa   )
						):
							lowerCamelCase_				:						int				  =				[array.astype(np.floataa   ) for array in input_values]
						elif isinstance(__lowercase					,			np.ndarray   ) and input_values.dtype is np.dtype(np.floataa   ):
							lowerCamelCase_				:						List[str]				  =				input_values.astype(np.floataa   )

						# convert attention_mask to correct format
						lowerCamelCase_				:						Any				  =				padded_inputs.get('attention_mask'   )
						if attention_mask is not None:
							lowerCamelCase_				:						Optional[int]				  =				[np.asarray(__lowercase					,			dtype=np.intaa   ) for array in attention_mask]

						# zero-mean and unit-variance normalization
						if self.do_normalize:
							lowerCamelCase_				:						Tuple				  =				(
							    attention_mask
							    if self._get_padding_strategies(__lowercase					,			max_length=__lowercase   ) is not PaddingStrategy.DO_NOT_PAD
							    else None
							)
							lowerCamelCase_				:						Any				  =				self.zero_mean_unit_var_norm(
							    padded_inputs['input_values']					,			attention_mask=__lowercase					,			padding_value=self.padding_value   )

						if return_tensors is not None:
							lowerCamelCase_				:						Any				  =				padded_inputs.convert_to_tensors(__lowercase   )

						return padded_inputs






def    snake_case   (				A		,  A     )				->				int:




	'''simple docstring'''


	if a < b:
		return gcd(A		,  A     )
	if a % b == 0:
		return b
	return gcd(A		,  a % b     )






def    snake_case   (				A		,  A		,  A     )				->				int:




	'''simple docstring'''


	if y == 0:
		return 1
	lowerCamelCase_				:						int				  =				power(A		,  y // 2		,  A     ) % mod
	lowerCamelCase_				:						List[Any]				  =				(temp * temp) % mod
	if y % 2 == 1:
		lowerCamelCase_				:						str				  =				(temp * x) % mod
	return temp






def    snake_case   (				A     )				->				bool:




	'''simple docstring'''


	lowerCamelCase_				:						Union[str, Any]				  =				2
	while b < n:
		if gcd(A		,  A     ) == 1 and power(A		,  n - 1		,  A     ) != 1:
			return False
		b += 1
	return True


if __name__ == "__main__":
							UpperCamelCase__						=		int(input('Enter number: ').strip())
							if is_carmichael_number(number):
														print(F'{number} is a Carmichael Number.')
							else:
														print(F'{number} is not a Carmichael Number.')
