test_cuda_ndarray.py 文件源码

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

项目:Theano-Deep-learning 作者: GeekLiB 项目源码 文件源码
def test_getshape():
    shapelist = [
        ((1, 2, 3), (1, 2, 3)),
        ((1,), (1,)),
        ((1, 2, 3), (3, 2, 1)),
        ((1, 2, 3), (6,)),
        ((1, 2, 3, 2), (6, 2)),
        ((2, 3, 2), (6, 2))
        ]

    def subtest(shape):
        a = theano._asarray(numpy.random.rand(*shape_1), dtype='float32')
        b = cuda_ndarray.CudaNdarray(a)
        assert b.shape == a.shape

    for shape_1, shape_2 in shapelist:
        subtest(shape_1)
        subtest(shape_2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号