[Sparse]add sparse unary api(sin/tan/pow/neg/log1p/square/cast...) #44022
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
APIs
Describe
增加SparseTensor一元操作API
1. paddle.incubate.sparse.sin(x, name=None)
2. paddle.incubate.sparse.nn.Relu() (x, name=None)
3. paddle.incubate.sparse.tan(x, name=None)
4. paddle.incubate.sparse.asin(x, name=None)
5. paddle.incubate.sparse.atan(x, name=None)
6. paddle.incubate.sparse.sinh(x, name=None)
7. paddle.incubate.sparse.tanh(x, name=None)
8. paddle.incubate.sparse.asinh(x, name=None)
9. paddle.incubate.sparse.atanh(x, name=None)
10. paddle.incubate.sparse.sqrt(x, name=None)
11. paddle.incubate.sparse.square(x, name=None)
12. paddle.incubate.sparse.log1p(x, name=None)
13. paddle.incubate.sparse.abs(x, name=None)
14. paddle.incubate.sparse.pow(x, factor, name=None)
15. paddle.incubate.sparse.cast(x, index_dtype=None, value_dtype=None, name=None)
16. paddle.incubate.sparse.neg(x, name=None)
增加乘法、除法scalar的操作
1. paddle.incubate.sparse.multiply(Tensor, scalar)
2. paddle.incubate.sparse.divide(Tensor, scalar)
增加类成员函数nnz
1. paddle.Tensor.nnz():返回SparseTensor中非0元素的个数