




import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


UpperCAmelCase_		:					Tuple          =  logging.get_logger(__name__)




class 		__A   (      UpperCamelCase__      ):
						UpperCamelCase      =       """upernet"""

						def __init__(		self :int     ,			__snake_case :int=None     ,			__snake_case :Optional[int]=5_12     ,			__snake_case :Any=0.02     ,			__snake_case :str=[1, 2, 3, 6]     ,			__snake_case :Optional[Any]=True     ,			__snake_case :Optional[Any]=0.4     ,			__snake_case :Tuple=3_84     ,			__snake_case :Optional[int]=2_56     ,			__snake_case :Dict=1     ,			__snake_case :Any=False     ,			__snake_case :Tuple=2_55     ,			**__snake_case :int     ,			):
										'''simple docstring'''

										super().__init__(**__snake_case			)

										if backbone_config is None:
														logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""			)
														__magic_name__						:						Optional[Any]										=CONFIG_MAPPING["""resnet"""](out_features=["""stage1""", """stage2""", """stage3""", """stage4"""]			)
										elif isinstance(__snake_case     ,			__snake_case			):
														__magic_name__						:						int										=backbone_config.get("""model_type"""			)
														__magic_name__						:						Optional[Any]										=CONFIG_MAPPING[backbone_model_type]
														__magic_name__						:						List[Any]										=config_class.from_dict(__snake_case			)

										__magic_name__						:						Dict										=backbone_config
										__magic_name__						:						Optional[Any]										=hidden_size
										__magic_name__						:						List[str]										=initializer_range
										__magic_name__						:						Tuple										=pool_scales
										__magic_name__						:						Optional[Any]										=use_auxiliary_head
										__magic_name__						:						List[str]										=auxiliary_loss_weight
										__magic_name__						:						int										=auxiliary_in_channels
										__magic_name__						:						Optional[int]										=auxiliary_channels
										__magic_name__						:						Optional[int]										=auxiliary_num_convs
										__magic_name__						:						int										=auxiliary_concat_input
										__magic_name__						:						Optional[Any]										=loss_ignore_index


						def      A__    (		self :Optional[int]			):
										'''simple docstring'''

										__magic_name__						:						List[str]										=copy.deepcopy(self.__dict__			)
										__magic_name__						:						Dict										=self.backbone_config.to_dict()
										__magic_name__						:						Optional[int]										=self.__class__.model_type
										return output








"""simple docstring"""




from collections.abc import Callable





def       a_ (	lowercase__ :Callable[[float], float],			lowercase__ :float,			lowercase__ :float     ):
			__lowerCamelCase          =      a
			__lowerCamelCase          =      b
			if function(lowercase__     ) == 0:  # one of the a or b is a root for the function
						return a
			elif function(lowercase__     ) == 0:
						return b
			elif (
			    function(lowercase__     ) * function(lowercase__     ) > 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:
						__lowerCamelCase          =      start + (end - start) / 2.0
						while abs(start - mid     ) > 10**-7:  # until precisely equals to 10^-7
									if function(lowercase__     ) == 0:
												return mid
									elif function(lowercase__     ) * function(lowercase__     ) < 0:
												__lowerCamelCase          =      mid
									else:
												__lowerCamelCase          =      mid
									__lowerCamelCase          =      start + (end - start) / 2.0
						return mid





def       a_ (	lowercase__ :float     ):
			return x**3 - 2 * x - 5


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

					import doctest

					doctest.testmod()




