// a very simple parser
def parse(string):
if type(string) is not str:
raise ValueError
if string in ["true", "True"]:
return True
elif string in ["false", "False"]:
return False
elif string in ["float64", "float32", "float16", "int64", "int32", "int16"]:
return getattr(tf, string)
elif any([string.count(s) for s in ".eE"]):
try:
return float(string)
except:
return string
else:
try: