test_gpu_operations.py 文件源码

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

项目:Aurora 作者: upul 项目源码 文件源码
def test_broadcast_to():
    ctx = ndarray.gpu(0)
    shape = (200, 300)
    to_shape = (130, 200, 300)
    x = np.random.uniform(-1, 1, shape).astype(np.float32)
    arr_x = ndarray.array(x, ctx=ctx)
    arr_y = ndarray.empty(to_shape, ctx=ctx)
    gpu_op.broadcast_to(arr_x, arr_y)
    y = arr_y.asnumpy()
    np.testing.assert_allclose(np.broadcast_to(x, to_shape), y)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号