test_multiarray.py 文件源码

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

项目:deliver 作者: orchestor 项目源码 文件源码
def test_partition_fuzz(self):
        # a few rounds of random data testing
        for j in range(10, 30):
            for i in range(1, j - 2):
                d = np.arange(j)
                np.random.shuffle(d)
                d = d % np.random.randint(2, 30)
                idx = np.random.randint(d.size)
                kth = [0, idx, i, i + 1]
                tgt = np.sort(d)[kth]
                assert_array_equal(np.partition(d, kth)[kth], tgt,
                                   err_msg="data: %r\n kth: %r" % (d, kth))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号