'''simple docstring'''


from collections import OrderedDict
from dataclasses import fields
from typing import Any, Tuple

import numpy as np

from .import_utils import is_torch_available


def    _lowerCamelCase       ( lowerCamelCase_   :				Dict  ):



     """simple docstring"""





     if is_torch_available():
          import torch

          if isinstance(lowerCamelCase_      ,	torch.Tensor  ):
               return True

     return isinstance(lowerCamelCase_      ,	np.ndarray  )






class 	__SCREAMING_SNAKE_CASE		(			lowerCamelCase_			):







  '''simple docstring'''






  def _UpperCamelCase	(					self		):




       '''simple docstring'''

       UpperCAmelCase_				:  Optional[Any]  = fields(self		)

       # Safety and consistency checks
       if not len(snake_case_		):
            raise ValueError(F'''{self.__class__.__name__} has no fields.'''		)

       UpperCAmelCase_				:  Tuple  = getattr(self ,						class_fields[0].name		)
       UpperCAmelCase_				:  str  = all(getattr(self ,						field.name		) is None for field in class_fields[1:]		)

       if other_fields_are_none and isinstance(snake_case_ ,						snake_case_		):
            for key, value in first_field.items():
                 UpperCAmelCase_				:  Optional[Any]  = value
       else:
            for field in class_fields:
                 UpperCAmelCase_				:  Dict  = getattr(self ,						field.name		)
                 if v is not None:
                      UpperCAmelCase_				:  Optional[Any]  = v


  def __delitem__(					self ,						*snake_case_ ,						**snake_case_		):




       '''simple docstring'''

       raise Exception(F'''You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'''		)


  def _UpperCamelCase	(					self ,						*snake_case_ ,						**snake_case_		):




       '''simple docstring'''

       raise Exception(F'''You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'''		)


  def _UpperCamelCase	(					self ,						*snake_case_ ,						**snake_case_		):




       '''simple docstring'''

       raise Exception(F'''You cannot use ``pop`` on a {self.__class__.__name__} instance.'''		)


  def _UpperCamelCase	(					self ,						*snake_case_ ,						**snake_case_		):




       '''simple docstring'''

       raise Exception(F'''You cannot use ``update`` on a {self.__class__.__name__} instance.'''		)


  def __getitem__(					self ,						snake_case_		):




       '''simple docstring'''

       if isinstance(snake_case_ ,						snake_case_		):
            UpperCAmelCase_				:  Tuple  = dict(self.items()		)
            return inner_dict[k]
       else:
            return self.to_tuple()[k]


  def __setattr__(					self ,						snake_case_ ,						snake_case_		):




       '''simple docstring'''

       if name in self.keys() and value is not None:
            # Don't call self.__setitem__ to avoid recursion errors
            super().__setitem__(snake_case_ ,						snake_case_		)
       super().__setattr__(snake_case_ ,						snake_case_		)


  def __setitem__(					self ,						snake_case_ ,						snake_case_		):




       '''simple docstring'''

       super().__setitem__(snake_case_ ,						snake_case_		)
       # Don't call self.__setattr__ to avoid recursion errors
       super().__setattr__(snake_case_ ,						snake_case_		)






  def _UpperCamelCase	(					self		):




       '''simple docstring'''

       return tuple(self[k] for k in self.keys()		)














import numpy as np







def   snake_case		(				UpperCAmelCase						:							Any ):
				A									=   np.exp(UpperCAmelCase )

				# Add up the all the exponentials
				A									=   np.sum(UpperCAmelCase )

				# Divide every exponent by the sum of all exponents
				A									=   exponent_vector / sum_of_exponents

				return softmax_vector


if __name__ == "__main__":
					print(softmax((0,)))





