yacs icon indicating copy to clipboard operation
yacs copied to clipboard

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

Open xwu4lab opened this issue 4 years ago • 1 comments

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.

xwu4lab avatar Dec 04 '20 03:12 xwu4lab

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!

naokiyokoyama avatar Apr 26 '22 15:04 naokiyokoyama