



import copy

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


__snake_case       :	Union[str, Any]            =logging.get_logger(__name__)



class  lowerCamelCase__    (							lowerCamelCase__):




		'''simple docstring'''



		snake_case_			="""upernet"""



		def __init__(self	,__lowerCamelCase=None	,__lowerCamelCase=5_12	,__lowerCamelCase=0.02	,__lowerCamelCase=[1, 2, 3, 6]	,__lowerCamelCase=True	,__lowerCamelCase=0.4	,__lowerCamelCase=3_84	,__lowerCamelCase=2_56	,__lowerCamelCase=1	,__lowerCamelCase=False	,__lowerCamelCase=2_55	,**__lowerCamelCase	,)  ->    Optional[Any]:

						"""simple docstring"""






						super().__init__(**__lowerCamelCase				)

						if backbone_config is None:
										logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'''				)
										lowerCAmelCase__  :       Union[str, Any]				=  CONFIG_MAPPING['''resnet'''](out_features=['''stage1''', '''stage2''', '''stage3''', '''stage4''']				)
						elif isinstance(__lowerCamelCase	,__lowerCamelCase				):
										lowerCAmelCase__  :       Union[str, Any]				=  backbone_config.get('''model_type'''				)
										lowerCAmelCase__  :       List[Any]				=  CONFIG_MAPPING[backbone_model_type]
										lowerCAmelCase__  :       List[Any]				=  config_class.from_dict(__lowerCamelCase				)

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



		def 	lowerCAmelCase__   (self				)  ->    Any:

						"""simple docstring"""






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






from collections.abc import Callable

import numpy as np






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Callable ,lowerCamelCase_	:	float ,lowerCamelCase_	:	float ,lowerCamelCase_	:	float ,lowerCamelCase_	:	float):





				'''simple docstring'''

				lowerCAmelCase__  :       Dict				=  int(np.ceil((x_end - xa) / step_size))
				lowerCAmelCase__  :       Any				=  np.zeros((n + 1,))
				lowerCAmelCase__  :       Union[str, Any]				=  ya
				lowerCAmelCase__  :       str				=  xa

				for k in range(lowerCamelCase_):
								lowerCAmelCase__  :       Tuple				=  y[k] + step_size * ode_func(lowerCamelCase_ ,y[k])
								lowerCAmelCase__  :       str				=  y[k] + (
								    (step_size / 2) * (ode_func(lowerCamelCase_ ,y[k]) + ode_func(x + step_size ,lowerCamelCase_))
								)
								x += step_size

				return y


if __name__ == "__main__":
							import doctest

							doctest.testmod()

