test_twodim_base.py 文件源码

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

项目:radar 作者: amoose136 项目源码 文件源码
def test_tril_triu_ndim2():
    for dtype in np.typecodes['AllFloat'] + np.typecodes['AllInteger']:
        a = np.ones((2, 2), dtype=dtype)
        b = np.tril(a)
        c = np.triu(a)
        yield assert_array_equal, b, [[1, 0], [1, 1]]
        yield assert_array_equal, c, b.T
        # should return the same dtype as the original array
        yield assert_equal, b.dtype, a.dtype
        yield assert_equal, c.dtype, a.dtype
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号