Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Sparse】add SparseTensor mv kernel(csr*dense_vec->dence_vec, coo*dense_vec->dense_vec) #43668

Merged
merged 2 commits into from
Jun 28, 2022

Conversation

zhwesky2010
Copy link
Contributor

@zhwesky2010 zhwesky2010 commented Jun 20, 2022

PR types

New features

PR changes

OPs

Describe

paddle.incubate.sparse.mv

import paddle
from paddle.fluid.framework import _test_eager_guard 
paddle.seed(100)

# csr @ dense -> dense
with _test_eager_guard():         
    crows = [0, 2, 3, 5]
    cols = [1, 3, 2, 0, 1]
    values = [1., 2., 3., 4., 5.]
    dense_shape = [3, 4]
    csr = paddle.incubate.sparse.sparse_csr_tensor(crows, cols, values, dense_shape)
    # Tensor(shape=[3, 4], dtype=paddle.float32, place=Place(gpu:0), stop_gradient=True, 
    #        crows=[0, 2, 3, 5], 
    #        cols=[1, 3, 2, 0, 1], 
    #        values=[1., 2., 3., 4., 5.])
    
    vec = paddle.randn([4])
    
    out = paddle.incubate.sparse.mv(csr, vec)
    # Tensor(shape=[3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
    #        [-3.85499096, -2.42975140, -1.75087738])

@paddle-bot-old
Copy link

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zhwesky2010 zhwesky2010 changed the title add kernel(csr*dense_vec->dence_vec, coo*dense_vec->dense_vec) of SparseTensor add SparseTensor mv kernel(csr*dense_vec->dence_vec, coo*dense_vec->dense_vec) Jun 20, 2022
@zhwesky2010 zhwesky2010 changed the title add SparseTensor mv kernel(csr*dense_vec->dence_vec, coo*dense_vec->dense_vec) 【Sparse】add SparseTensor mv kernel(csr*dense_vec->dence_vec, coo*dense_vec->dense_vec) Jun 20, 2022
@zhwesky2010 zhwesky2010 force-pushed the sparse_mv branch 2 times, most recently from e49e3ae to 99fc120 Compare June 22, 2022 13:50
@zhwesky2010 zhwesky2010 force-pushed the sparse_mv branch 5 times, most recently from 637e57c to b45b528 Compare June 24, 2022 15:26
chenwhql
chenwhql previously approved these changes Jun 27, 2022
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for const_cast

wanghuancoder
wanghuancoder previously approved these changes Jun 27, 2022
@zhwesky2010 zhwesky2010 dismissed stale reviews from wanghuancoder and chenwhql via 8212c44 June 27, 2022 13:58
@zhwesky2010 zhwesky2010 merged commit 5161a04 into PaddlePaddle:develop Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants