-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-392] Support for a bunch of unary functions for csr matrices #11559
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. a few comments:
@@ -70,7 +70,7 @@ static bool IdentityAttrLikeRhsStorageType(const nnvm::NodeAttrs& attrs, | |||
} | |||
|
|||
// relu | |||
MXNET_OPERATOR_REGISTER_UNARY(relu) | |||
MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP_CSR(relu, cpu, mshadow_op::relu) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to move MXNET_ADD_SPARSE_OP_ALIAS inside MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP_CSR. Do you mind changing that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually none of MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP_CSR/MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP/MXNET_OPERATOR_REGISTER_UNARY_WITH_SPARSE_DR has MXNET_ADD_SPARSE_OP_ALIAS in them, do you want to add that to all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add for MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP_CSR
and MXNET_OPERATOR_REGISTER_UNARY_WITH_RSP
. Lets skip the ones with SPARSE_DR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -81,11 +81,9 @@ The storage type of ``relu`` output depends upon the input storage type: | |||
|
|||
- relu(default) = default | |||
- relu(row_sparse) = row_sparse | |||
- relu(csr) = csr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add fluent methods to CSRNDArray documentation like what was did for RowSparseNDArray https://github.com/apache/incubator-mxnet/blob/master/docs/api/python/ndarray/sparse.md#trigonometric-functions
And add tests in https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_sparse_ndarray.py#L847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
73aefaf
to
ceb0fed
Compare
docs/api/python/ndarray/sparse.md
Outdated
@@ -520,7 +583,7 @@ We summarize the interface for each class in the following sections. | |||
```eval_rst | |||
|
|||
.. autoclass:: mxnet.ndarray.sparse.CSRNDArray | |||
:members: shape, context, dtype, stype, data, indices, indptr, copy, copyto, as_in_context, asscipy, asnumpy, asscalar, astype, tostype, slice, wait_to_read, zeros_like, __neg__, sum, mean, norm, square, __getitem__, __setitem__, check_format | |||
:members: shape, context, dtype, stype, data, indices, indptr, copy, copyto, as_in_context, asscipy, asnumpy, asscalar, astype, tostype, slice, wait_to_read, zeros_like, round, rint, fix, floor, ceil, trunc, sin, tan, arcsin, arctan, degrees, radians, sinh, tanh, arcsinh, arctanh, expm1, log1p, sqrt, square, __neg__, sum, mean, norm, square, __getitem__, __setitem__, check_format, clip, sign | |||
|
|||
.. autoclass:: mxnet.ndarray.sparse.RowSparseNDArray | |||
:members: shape, context, dtype, stype, data, indices, copy, copyto, as_in_context, asnumpy, asscalar, astype, tostype, wait_to_read, zeros_like, round, rint, fix, floor, ceil, trunc, sin, tan, arcsin, arctan, degrees, radians, sinh, tanh, arcsinh, arctanh, expm1, log1p, sqrt, square, __negative__, norm, __getitem__, __setitem__, check_format, retain, clip, sign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add abs for RowSparse: members?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you mean this one, will do soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to merge once the last comment is addressed
…pache#11559) * support for relu(csr) = csr * add support for sign(csr) = csr * add support for round * add support for ceil(csr)=csr * add support for floor(csr)=csr * add support for trunc(csr)=csr * add support for fix(csr)=csr * add support for sqrt(csr)=csr * add support for cbrt(csr)=csr * add support for log1p(csr)=csr * add support for expm1(csr)=csr * add support for sin(csr)=csr * add support for tan(csr)=csr * add support for arcsin(csr)=csr * add support for arctan(csr)=csr * add support for degrees(csr)=csr * add support for radians(csr)=csr * add support for sinh(csr)=csr * add support for tanh(csr)=csr * add support for arcsinh(csr)=csr * add support for arctanh(csr)=csr * restore original check_sparse_function func * add test for fluent and doc * address code review
Description
As title
Checklist
Essentials
Changes
Comments