trainkit.py 文件源码

python
阅读 14 收藏 0 点赞 0 评论 0

项目:nature_methods_multicut_pipeline 作者: ilastik 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号