data like 1e-3 loaded from yaml is with type str

#46 · open · 1 comments

View on GitHub ↗

xwu4lab

It seems the decode is not performed when the value is loaded from file (such as yaml), so that data like 1e-3 will be recognized as str instead of float.

Comments

naokiyokoyama

This is because of how PyYAML loads the file. Yacs only has visibility to the dictionary generated by PyYAML, at which point "1e-3" has already been decoded as a string. The way to fix your issue is to write "1.0e3" instead; then PyYAML will decode it as a float!