





from math import factorial, pi







def 					_SCREAMING_SNAKE_CASE							(  a   ,		a = 30    ) -> float:

					if not isinstance(__UpperCAmelCase   ,		(int, float)    ):
										raise ValueError('maclaurin_sin() requires either an int or float for theta'    )

					if not isinstance(__UpperCAmelCase   ,		__UpperCAmelCase    ) or accuracy <= 0:
										raise ValueError('maclaurin_sin() requires a positive int for accuracy'    )

					__A      :		Any         =							float(__UpperCAmelCase    )
					__A      :		Optional[Any]         =							theta // (2 * pi)
					theta -= 2 * div * pi
					return sum(
					    (-1) ** r * theta ** (2 * r + 1) / factorial(2 * r + 1    ) for r in range(__UpperCAmelCase    )    )







def 					_SCREAMING_SNAKE_CASE							(  a   ,		a = 30    ) -> float:

					if not isinstance(__UpperCAmelCase   ,		(int, float)    ):
										raise ValueError('maclaurin_cos() requires either an int or float for theta'    )

					if not isinstance(__UpperCAmelCase   ,		__UpperCAmelCase    ) or accuracy <= 0:
										raise ValueError('maclaurin_cos() requires a positive int for accuracy'    )

					__A      :		List[str]         =							float(__UpperCAmelCase    )
					__A      :		Tuple         =							theta // (2 * pi)
					theta -= 2 * div * pi
					return sum((-1) ** r * theta ** (2 * r) / factorial(2 * r    ) for r in range(__UpperCAmelCase    )    )


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				print(maclaurin_sin(10))
				print(maclaurin_sin(-10))
				print(maclaurin_sin(10, 15))
				print(maclaurin_sin(-10, 15))

				print(maclaurin_cos(5))
				print(maclaurin_cos(-5))
				print(maclaurin_cos(10, 15))
				print(maclaurin_cos(-10, 15))












"""simple docstring"""





from typing import Union

import fire
import torch
from tqdm import tqdm



def   a    (     __UpperCAmelCase      :    str      ,   __UpperCAmelCase      :    str = "cpu"      ,   __UpperCAmelCase      :    Union[str, None] = None  )    ->							None:
						__magic_name__:	List[Any]							=       torch.load(__UpperCAmelCase      ,   map_location=__UpperCAmelCase  )
						for k, v in tqdm(state_dict.items()  ):
												if not isinstance(__UpperCAmelCase      ,   torch.Tensor  ):
																		raise TypeError("""FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin"""  )
												__magic_name__:	Any							=       v.half()
						if save_path is None:  # overwrite src_path
												__magic_name__:	List[str]							=       src_path
						torch.save(__UpperCAmelCase      ,   __UpperCAmelCase  )


if __name__ == "__main__":
							fire.Fire(convert)



