def read(self):
# Check if there are changes to the read
filehaschanged = os.stat(self.ymlfile).st_mtime != self.lastmodified
# Update lastmodified timestamp
if filehaschanged:
self.lastmodified = os.stat(self.ymlfile).st_mtime
else:
return
# Read from file
with open(self.ymlfile, 'r') as f:
update = yaml.load(f)
# Update switches
for switchname, switchvar in self.switches.items():
# Fetch
if switchname in update.keys():
# Check if update needs to be eval-ed
if isinstance(update[switchname], str) and update[switchname].startswith('np.'):
switchvarval = eval(update[switchname])
else:
switchvarval = getattr(np, config.floatX)(update[switchname])
# Set switch variable
switchvar.set_value(switchvarval)
return
trainkit.py 文件源码
python
阅读 14
收藏 0
点赞 0
评论 0
评论列表
文章目录