pprof.py 文件源码

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

项目:NLP.py 作者: PythonOptimizers 项目源码 文件源码
def add_solver(self, fname):
        """Collect metrics for each solver."""
        comment = re.compile(r'^[\s]*[%#]')
        column = re.compile(self.options['sep'])

        # Grab the column from the file.
        metrics = []
        with open(fname, 'r') as fp:
            for line in fp:
                if not comment.match(line):
                    line = line.strip()
                    cols = column.split(line)
                    data = atof(cols[self.options['datacol'] - 1])
                    metrics.append(data)

        self.metrics.append(metrics)
        if len(metrics) != len(self.metrics[0]):
            raise ValueError('All solvers must have same number of problems.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号