Skip to content

Commit

Permalink
update relu for new sparse api
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaishaonvjituizi committed Apr 20, 2022
1 parent d4310af commit 7e5f102
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/paddle/sparse/functional/activation.py
Expand Up @@ -47,7 +47,11 @@ def relu(x, name=None):
"""

assert in_dynamic_mode(), "Currently, Sparse API only support dynamic mode"
assert x.is_sparse_coo(
), "Currently, sparse.relu only support the input of SparseCooTensor"

return _C_ops.final_state_sparse_relu(x)
if x.is_sparse_coo():
return _C_ops.final_state_sparse_coo_relu(x)
elif x.is_sparse_csr():
return _C_ops.final_state_sparse_csr_relu(x)
else:
raise ValueError("Currently, sparse.relu only support the input of SparseCooTensor or SparseCsrTensor")

0 comments on commit 7e5f102

Please sign in to comment.