



"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


__lowerCAmelCase       :					Optional[Any]      					=					{
    '''configuration_wav2vec2''': ['''WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Wav2Vec2Config'''],
    '''feature_extraction_wav2vec2''': ['''Wav2Vec2FeatureExtractor'''],
    '''processing_wav2vec2''': ['''Wav2Vec2Processor'''],
    '''tokenization_wav2vec2''': ['''Wav2Vec2CTCTokenizer''', '''Wav2Vec2Tokenizer'''],
}


try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowerCAmelCase       :					Any      					=					[
					    '''WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''Wav2Vec2ForAudioFrameClassification''',
					    '''Wav2Vec2ForCTC''',
					    '''Wav2Vec2ForMaskedLM''',
					    '''Wav2Vec2ForPreTraining''',
					    '''Wav2Vec2ForSequenceClassification''',
					    '''Wav2Vec2ForXVector''',
					    '''Wav2Vec2Model''',
					    '''Wav2Vec2PreTrainedModel''',
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowerCAmelCase       :					Union[str, Any]      					=					[
					    '''TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
					    '''TFWav2Vec2ForCTC''',
					    '''TFWav2Vec2Model''',
					    '''TFWav2Vec2PreTrainedModel''',
					    '''TFWav2Vec2ForSequenceClassification''',
					]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowerCAmelCase       :					List[str]      					=					[
					    '''FlaxWav2Vec2ForCTC''',
					    '''FlaxWav2Vec2ForPreTraining''',
					    '''FlaxWav2Vec2Model''',
					    '''FlaxWav2Vec2PreTrainedModel''',
					]


if TYPE_CHECKING:
					from .configuration_wavaveca import WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP, WavaVecaConfig
					from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
					from .processing_wavaveca import WavaVecaProcessor
					from .tokenization_wavaveca import WavaVecaCTCTokenizer, WavaVecaTokenizer

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_wavaveca import (
										    WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
										    WavaVecaForAudioFrameClassification,
										    WavaVecaForCTC,
										    WavaVecaForMaskedLM,
										    WavaVecaForPreTraining,
										    WavaVecaForSequenceClassification,
										    WavaVecaForXVector,
										    WavaVecaModel,
										    WavaVecaPreTrainedModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_wavaveca import (
										    TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFWavaVecaForCTC,
										    TFWavaVecaForSequenceClassification,
										    TFWavaVecaModel,
										    TFWavaVecaPreTrainedModel,
										)

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_wavaveca import (
										    FlaxWavaVecaForCTC,
										    FlaxWavaVecaForPreTraining,
										    FlaxWavaVecaModel,
										    FlaxWavaVecaPreTrainedModel,
										)


else:
					import sys

					__lowerCAmelCase       :					str      					=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






"""simple docstring"""





from collections.abc import Callable
from math import pi, sqrt
from random import uniform
from statistics import mean
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						def is_in_circle(__UpperCamelCase      :			float					, __UpperCamelCase      :			float    ) -> bool:
												snake_case_   : Dict						=			sqrt((x**2) + (y**2)    )
												# Our circle has a radius of 1, so a distance
												# greater than 1 would land outside the circle.
												return distance_from_centre <= 1

						# The proportion of guesses that landed in the circle
						snake_case_   : Tuple						=			mean(
						    int(is_in_circle(uniform(-1.0					, 1.0    )					, uniform(-1.0					, 1.0    )    )    )
						    for _ in range(__UpperCamelCase    )    )
						# The ratio of the area for circle to square is pi/4.
						snake_case_   : Union[str, Any]						=			proportion * 4
						print(F'The estimated value of pi is {pi_estimate}'    )
						print(F'The numpy value of pi is {pi}'    )
						print(F'The total error is {abs(pi - pi_estimate    )}'    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			Callable[[float], float]					, __UpperCamelCase      :			float = 0.0					, __UpperCamelCase      :			float = 1.0					, ):


						'''simple docstring'''






						return mean(
						    function_to_integrate(uniform(__UpperCamelCase					, __UpperCamelCase    )    ) for _ in range(__UpperCamelCase    )    ) * (max_value - min_value)
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			float = 0.0					, __UpperCamelCase      :			float = 1.0    ):


						'''simple docstring'''






						def identity_function(__UpperCamelCase      :			float    ) -> float:
												return x

						snake_case_   : int						=			area_under_curve_estimator(
						    __UpperCamelCase					, __UpperCamelCase					, __UpperCamelCase					, __UpperCamelCase    )
						snake_case_   : str						=			(max_value * max_value - min_value * min_value) / 2

						print("""******************"""    )
						print(F'Estimating area under y=x where x varies from {min_value} to {max_value}'    )
						print(F'Estimated value is {estimated_value}'    )
						print(F'Expected value is {expected_value}'    )
						print(F'Total error is {abs(estimated_value - expected_value    )}'    )
						print("""******************"""    )
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						def function_to_integrate(__UpperCamelCase      :			float    ) -> float:
												return sqrt(4.0 - x * x    )

						snake_case_   : List[Any]						=			area_under_curve_estimator(
						    __UpperCamelCase					, __UpperCamelCase					, 0.0					, 2.0    )

						print("""******************"""    )
						print("""Estimating pi using area_under_curve_estimator"""    )
						print(F'Estimated value is {estimated_value}'    )
						print(F'Expected value is {pi}'    )
						print(F'Total error is {abs(estimated_value - pi    )}'    )
						print("""******************"""    )


if __name__ == "__main__":
					import doctest

					doctest.testmod()

