'''simple docstring'''


from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__lowerCAmelCase	:       Any						       =	logging.get_logger(__name__)

__lowerCAmelCase	:       str						       =	{
    "microsoft/focalnet-tiny": "https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json",
}






class 						A   (   UpperCAmelCase       ,	UpperCAmelCase   ):
							a_        =      '''focalnet'''





							def __init__(      self				:							Optional[int]     ,		__a				:							Tuple=2_2_4     ,		__a				:							Dict=4     ,		__a				:							int=3     ,		__a				:							int=9_6     ,		__a				:							int=False     ,		__a				:							Optional[int]=[1_9_2, 3_8_4, 7_6_8, 7_6_8]     ,		__a				:							Tuple=[2, 2, 6, 2]     ,		__a				:							List[Any]=[2, 2, 2, 2]     ,		__a				:							Optional[Any]=[3, 3, 3, 3]     ,		__a				:							Tuple="gelu"     ,		__a				:							Optional[int]=4.0     ,		__a				:							Optional[Any]=0.0     ,		__a				:							Optional[int]=0.1     ,		__a				:							int=False     ,		__a				:							List[Any]=1e-4     ,		__a				:							Tuple=False     ,		__a				:							Union[str, Any]=False     ,		__a				:							List[str]=False     ,		__a				:							Tuple=0.0_2     ,		__a				:							str=1e-5     ,		__a				:							Optional[int]=3_2     ,		__a				:							Optional[int]=None     ,		__a				:							List[Any]=None     ,		**__a				:							Union[str, Any]     ,		)							->	Optional[Any]:
								super().__init__(**__a	)

								__UpperCAmelCase							=			image_size
								__UpperCAmelCase							=			patch_size
								__UpperCAmelCase							=			num_channels
								__UpperCAmelCase							=			embed_dim
								__UpperCAmelCase							=			use_conv_embed
								__UpperCAmelCase							=			hidden_sizes
								__UpperCAmelCase							=			depths
								__UpperCAmelCase							=			focal_levels
								__UpperCAmelCase							=			focal_windows
								__UpperCAmelCase							=			hidden_act
								__UpperCAmelCase							=			mlp_ratio
								__UpperCAmelCase							=			hidden_dropout_prob
								__UpperCAmelCase							=			drop_path_rate
								__UpperCAmelCase							=			use_layerscale
								__UpperCAmelCase							=			layerscale_value
								__UpperCAmelCase							=			use_post_layernorm
								__UpperCAmelCase							=			use_post_layernorm_in_modulation
								__UpperCAmelCase							=			normalize_modulator
								__UpperCAmelCase							=			initializer_range
								__UpperCAmelCase							=			layer_norm_eps
								__UpperCAmelCase							=			encoder_stride
								__UpperCAmelCase							=			['''stem'''] + [f"""stage{idx}""" for idx in range(1     ,		len(self.depths	) + 1	)]
								__UpperCAmelCase				,			__UpperCAmelCase							=			get_aligned_output_features_output_indices(
								    out_features=__a     ,		out_indices=__a     ,		stage_names=self.stage_names	)

'''simple docstring'''


from __future__ import annotations

from statistics import mean





def       lowerCAmelCase					(		UpperCamelCase__				:   list[int]    ,					UpperCamelCase__				:   list[int]    ,					UpperCamelCase__				:   int       ):


	"""simple docstring"""
	__UpperCAmelCase							=			[0] * no_of_processes
	__UpperCAmelCase							=			[0] * no_of_processes

	# Initialize remaining_time to waiting_time.

	for i in range(UpperCamelCase__       ):
		__UpperCAmelCase							=			burst_time[i]
	__UpperCAmelCase							=			[]

	__UpperCAmelCase							=			0
	__UpperCAmelCase							=			0

	# When processes are not completed,
	# A process whose arrival time has passed \
	# and has remaining execution time is put into the ready_process.
	# The shortest process in the ready_process, target_process is executed.

	while completed != no_of_processes:
		__UpperCAmelCase							=			[]
		__UpperCAmelCase							=			-1

		for i in range(UpperCamelCase__       ):
			if (arrival_time[i] <= total_time) and (remaining_time[i] > 0):
				ready_process.append(UpperCamelCase__       )

		if len(UpperCamelCase__       ) > 0:
			__UpperCAmelCase							=			ready_process[0]
			for i in ready_process:
				if remaining_time[i] < remaining_time[target_process]:
					__UpperCAmelCase							=			i
			total_time += burst_time[target_process]
			completed += 1
			__UpperCAmelCase							=			0
			__UpperCAmelCase							=			(
			    total_time - arrival_time[target_process] - burst_time[target_process]
			)
		else:
			total_time += 1

	return waiting_time





def       lowerCAmelCase					(		UpperCamelCase__				:   list[int]    ,					UpperCamelCase__				:   int    ,					UpperCamelCase__				:   list[int]       ):


	"""simple docstring"""
	__UpperCAmelCase							=			[0] * no_of_processes
	for i in range(UpperCamelCase__       ):
		__UpperCAmelCase							=			burst_time[i] + waiting_time[i]
	return turn_around_time


if __name__ == "__main__":
					print("[TEST CASE 01]")

					__lowerCAmelCase	:       List[Any]						       =	4
					__lowerCAmelCase	:       List[Any]						       =	[2, 5, 3, 7]
					__lowerCAmelCase	:       Tuple						       =	[0, 0, 0, 0]
					__lowerCAmelCase	:       Optional[int]						       =	calculate_waitingtime(arrival_time, burst_time, no_of_processes)
					__lowerCAmelCase	:       Dict						       =	calculate_turnaroundtime(
					    burst_time, no_of_processes, waiting_time
					)

					# Printing the Result
					print("PID\tBurst Time\tArrival Time\tWaiting Time\tTurnaround Time")
					for i, process_id in enumerate(list(range(1, 5))):
										print(
										    F"""{process_id}\t{burst_time[i]}\t\t\t{arrival_time[i]}\t\t\t\t"""
										    F"""{waiting_time[i]}\t\t\t\t{turn_around_time[i]}"""
										)
					print(F"""\nAverage waiting time = {mean(waiting_time):.5f}""")
					print(F"""Average turnaround time = {mean(turn_around_time):.5f}""")
