



'''simple docstring'''





def 							lowerCamelCase	(					_snake_case	:    list							):





    '''simple docstring'''


    if not isinstance(_snake_case  ,_snake_case							):
        raise ValueError("Input series is not valid, valid series - [2, 4, 6]"							)
    if len(_snake_case							) == 0:
        raise ValueError("Input list must be a non empty list"							)
    if len(_snake_case							) == 1:
        return True
    lowercase__									=    series[1] - series[0]
    for index in range(len(_snake_case							) - 1							):
        if series[index + 1] - series[index] != common_diff:
            return False
    return True




def 							lowerCamelCase	(					_snake_case	:    list							):





    '''simple docstring'''


    if not isinstance(_snake_case  ,_snake_case							):
        raise ValueError("Input series is not valid, valid series - [2, 4, 6]"							)
    if len(_snake_case							) == 0:
        raise ValueError("Input list must be a non empty list"							)
    lowercase__									=    0
    for val in series:
        answer += val
    return answer / len(_snake_case							)


if __name__ == "__main__":
 import doctest

 doctest.testmod()









'''simple docstring'''





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 					snake_case			(UpperCamelCase		,   UpperCamelCase ):



       @register_to_config
       def __init__(					self  ,UpperCAmelCase_ = 768  ,)	->				List[Any]:
           super().__init__()

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



       def 				_a   (					self  ,UpperCAmelCase_ = None  ,UpperCAmelCase_ = None  ,)	->				Any:
           lowercase__									=    nn.Parameter(self.mean.to(UpperCAmelCase_   ).to(UpperCAmelCase_   )   )
           lowercase__									=    nn.Parameter(self.std.to(UpperCAmelCase_   ).to(UpperCAmelCase_   )   )
           return self



       def 				_a   (					self  ,UpperCAmelCase_   )	->				Tuple:
           lowercase__									=    (embeds - self.mean) * 1.0 / self.std
           return embeds







       def 				_a   (					self  ,UpperCAmelCase_   )	->				List[str]:
           lowercase__									=    (embeds * self.std) + self.mean
           return embeds




