






from typing import TYPE_CHECKING

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


a__       =     {
    "configuration_convnext": ["CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvNextConfig", "ConvNextOnnxConfig"]
}

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a__       =     ["ConvNextFeatureExtractor"]
	a__       =     ["ConvNextImageProcessor"]

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a__       =     [
	    "CONVNEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "ConvNextForImageClassification",
	    "ConvNextModel",
	    "ConvNextPreTrainedModel",
	    "ConvNextBackbone",
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	a__       =     [
	    "TFConvNextForImageClassification",
	    "TFConvNextModel",
	    "TFConvNextPreTrainedModel",
	]

if TYPE_CHECKING:
	from .configuration_convnext import CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvNextConfig, ConvNextOnnxConfig

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_convnext import ConvNextFeatureExtractor
		from .image_processing_convnext import ConvNextImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_convnext import (
		    CONVNEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    ConvNextBackbone,
		    ConvNextForImageClassification,
		    ConvNextModel,
		    ConvNextPreTrainedModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_convnext import TFConvNextForImageClassification, TFConvNextModel, TFConvNextPreTrainedModel


else:
	import sys

	a__       =     _LazyModule(__name__, globals()["""__file__"""], _import_structure)








from collections.abc import Callable

def _UpperCAmelCase   (	a						:	Callable[[float], float]  ,					a						:	float  ,					a						:	float ):
							snake_case__	  =       a
							snake_case__	  =       b
							if function(a ) == 0:  # one of the a or b is a root for the function
														return a
							elif function(a ) == 0:
														return b
							elif (
							    function(a ) * function(a ) > 0
							):  # if none of these are root and they are both positive or negative,
														# then this algorithm can't find the root
														raise ValueError("""could not find root in given interval.""" )
							else:
														snake_case__	  =       start + (end - start) / 2.0
														while abs(start - mid ) > 10**-7:  # until precisely equals to 10^-7
																					if function(a ) == 0:
																												return mid
																					elif function(a ) * function(a ) < 0:
																												snake_case__	  =       mid
																					else:
																												snake_case__	  =       mid
																					snake_case__	  =       start + (end - start) / 2.0
														return mid

def _UpperCAmelCase   (	a						:	float ):
							return x**3 - 2 * x - 5


if __name__ == "__main__":
	print(bisection(f, 1, 1_0_0_0))

	import doctest

	doctest.testmod()
