


from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin



class 				A       (			UpperCAmelCase__					,    UpperCAmelCase__				):
					'''simple docstring'''






					@register_to_config
					def __init__(self       :		str ,   _UpperCAmelCase       :		int = 768 ,   )		->  List[str]:




							"""simple docstring"""


							super().__init__()

							lowercase__	     =						nn.Parameter(torch.zeros(1 ,   _UpperCAmelCase						)						)
							lowercase__	     =						nn.Parameter(torch.ones(1 ,   _UpperCAmelCase						)						)

					def     lowerCamelCase__	(self       :		List[Any] ,   _UpperCAmelCase       :		Optional[Union[str, torch.device]] = None ,   _UpperCAmelCase       :		Optional[torch.dtype] = None ,   )		->  int:




							"""simple docstring"""


							lowercase__	     =						nn.Parameter(self.mean.to(_UpperCAmelCase						).to(_UpperCAmelCase						)						)
							lowercase__	     =						nn.Parameter(self.std.to(_UpperCAmelCase						).to(_UpperCAmelCase						)						)
							return self

					def     lowerCamelCase__	(self       :		Optional[int] ,   _UpperCAmelCase       :		Dict						)		->  Union[str, Any]:




							"""simple docstring"""


							lowercase__	     =						(embeds - self.mean) * 1.0 / self.std
							return embeds


					def     lowerCamelCase__	(self       :		Dict ,   _UpperCAmelCase       :		Tuple						)		->  List[str]:




							"""simple docstring"""


							lowercase__	     =						(embeds * self.std) + self.mean
							return embeds


'''simple docstring'''




import numpy as np






def __lowerCAmelCase					(				UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							,    UpperCamelCase__							)      ->       str:
    __lowerCamelCase            =    int(np.ceil((x_end - xa) / h							)							)
    __lowerCamelCase            =    np.zeros((n + 1,)							)
    __lowerCamelCase            =    ya
    __lowerCamelCase            =    xa

    for k in range(UpperCamelCase__							):
        __lowerCamelCase            =    f(UpperCamelCase__							,    y[k]							)
        __lowerCamelCase            =    f(x + 0.5 * h							,    y[k] + 0.5 * h * ka							)
        __lowerCamelCase            =    f(x + 0.5 * h							,    y[k] + 0.5 * h * ka							)
        __lowerCamelCase            =    f(x + h							,    y[k] + h * ka							)
        __lowerCamelCase            =    y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
        x += h

    return y


if __name__ == "__main__":
  import doctest

  doctest.testmod()
