"""simple docstring"""



def 	_lowerCamelCase(	a   ,    a				):
       if discount_rate < 0:
              raise ValueError("Discount rate cannot be negative"				)
       if not cash_flows:
              raise ValueError("Cash flows list cannot be empty"				)
       __a       =    sum(
           cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(a				)				)
       return round(a   ,    ndigits=2				)


if __name__ == "__main__":
   import doctest

   doctest.testmod()

"""simple docstring"""



from typing import Union

import fire
import torch
from tqdm import tqdm



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


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