



'''simple docstring'''
from collections.abc import Callable

import numpy as np






def A__   (					UpperCAmelCase_  ,  UpperCAmelCase_  ,  UpperCAmelCase_  ,  UpperCAmelCase_  ,  UpperCAmelCase_							):
						_UpperCamelCase :		str			    =       int(np.ceil((x_end - xa) / step_size							)							)
						_UpperCamelCase :		List[str]			    =       np.zeros((n + 1,)							)
						_UpperCamelCase :		List[str]			    =       ya
						_UpperCamelCase :		Union[str, Any]			    =       xa

						for k in range(lowerCamelCase__							):
												_UpperCamelCase :		Union[str, Any]			    =       y[k] + step_size * ode_func(lowerCamelCase__  ,  y[k]							)
												_UpperCamelCase :		Optional[Any]			    =       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()







'''simple docstring'''
from torch import nn






def A__   (					UpperCAmelCase_							):
						if act_fn in ["swish", "silu"]:
												return nn.SiLU()
						elif act_fn == "mish":
												return nn.Mish()
						elif act_fn == "gelu":
												return nn.GELU()
						else:
												raise ValueError(f'Unsupported activation function: {act_fn}'							)


