factory.py 文件源码

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

项目:dirtools3 作者: kirpit 项目源码 文件源码
def _random_depths(self):
        # Pick a random depth
        middle = (self._max_depth // 2) + 1
        weight = self._max_depth + 1
        population = range(weight)
        cum_weights = list()
        cumulative = 0.8
        for d in population:
            # first value 0 (zero) will start with default weight
            if d <= middle:
                cumulative += d
                cum_weights.append(cumulative)
            else:
                cumulative += weight - d
                cum_weights.append(cumulative)
        return choices(population, cum_weights=cum_weights, k=self.total_items)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号