


"""simple docstring"""

import math






def 							A						(    snake_case				:int		)				->     int:

 if not isinstance(snake_case    , snake_case		):
  __UpperCamelCase      =	f'Input value of [number={number}] must be an integer'
  raise TypeError(snake_case		)

 if number < 1:
  __UpperCamelCase      =	f'Input value of [number={number}] must be > 0'
  raise ValueError(snake_case		)
 elif number == 1:
  return 3
 elif number == 2:
  return 5
 else:
  __UpperCamelCase      =	int(math.log(number // 3    , 2		)		) + 2

  __UpperCamelCase      =	[3, 5]
  __UpperCamelCase      =	2
  __UpperCamelCase      =	3
  for block in range(1    , snake_case		):
   for _ in range(snake_case		):
    proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1]		)
    proth_index += 1
   increment *= 2

 return proth_list[number - 1]


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      for number in range(1_1):
            UpperCamelCase     :    Optional[int]       =			0
            try:
                  UpperCamelCase     :    Any       =			proth(number)
            except ValueError:
                  print(f'''ValueError: there is no {number}th Proth number''')
                  continue

            print(f'''The {number}th Proth number: {value}''')





"""simple docstring"""

from typing import Union

import fire
import torch
from tqdm import tqdm






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


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



