Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-978] Higher Order Gradient Support sinh, cosh. #15412

Merged

Conversation

kshitij12345
Copy link
Contributor

Description

PR intends to add support for higher order gradient for sinh, cosh.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA-978 issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • higher order gradient for a sinh, cosh.
  • unit test for the same.

@kshitij12345 kshitij12345 changed the title Higher Order Gradient Support sinh, cosh. [MXNET-978] Higher Order Gradient Support sinh, cosh. Jun 29, 2019
@anirudhacharya
Copy link
Member

@mxnet-label-bot add [pr-awaiting-review]

@marcoabreu marcoabreu added the pr-awaiting-review PR is waiting for code review label Jul 1, 2019
@apeforest apeforest self-requested a review July 10, 2019 22:16
@karan6181
Copy link
Contributor

@apeforest Could you please review the PR? Thanks!

@@ -92,7 +92,7 @@ The storage type of ``cos`` output is always dense
MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU(_backward_cos, unary_bwd<mshadow_op::cos_grad>)
.set_attr<nnvm::FGradient>("FGradient",
[](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
// ograds[0]: head_grad_grads (dL/dx_grad)
// ograds[0]: head_grad_grads (dL/dy_grad)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this? I think the original dL/dx_grad is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please have a look and let me know what you think.
#15331 (comment)

@@ -49,7 +49,7 @@ The storage type of ``sin`` output depends upon the input storage type:
MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU_DR(_backward_sin, unary_bwd<mshadow_op::sin_grad>)
.set_attr<nnvm::FGradient>("FGradient",
[](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
// ograds[0]: head_grad_grads (dL/dxgrad)
// ograds[0]: head_grad_grads (dL/dy_grad)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this? I think the original dL/dx_grad is correct.

MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU_DR(_backward_sinh, unary_bwd<mshadow_op::sinh_grad>)
.set_attr<nnvm::FGradient>("FGradient",
[](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
// ograds[0]: dL/dy_grad
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this? I think the original dL/dx_grad is correct.

MXNET_OPERATOR_REGISTER_BINARY_WITH_SPARSE_CPU(_backward_cosh, unary_bwd<mshadow_op::cosh_grad>)
.set_attr<nnvm::FGradient>("FGradient",
[](const nnvm::NodePtr& n, const std::vector<nnvm::NodeEntry>& ograds) {
// ograds[0]: dL/dy_grad
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change this? I think the original dL/dx_grad is correct.

@kshitij12345 kshitij12345 force-pushed the develop/add-higher-order/sinh-cosh branch from 95cadc1 to 794eefd Compare July 26, 2019 14:56
@karan6181
Copy link
Contributor

@kshitij12345 is this PR good to go for merge?
@apeforest Could you please look into the updates? Thanks

@kshitij12345
Copy link
Contributor Author

I guess we should wait till #15531 is in.

@kshitij12345
Copy link
Contributor Author

@larroy @apeforest Gentle ping for review.

Copy link
Contributor

@apeforest apeforest left a comment

Choose a reason for hiding this comment

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

LGTM!

@apeforest apeforest merged commit eb037a8 into apache:master Sep 11, 2019
@kshitij12345 kshitij12345 deleted the develop/add-higher-order/sinh-cosh branch September 12, 2019 03:11
larroy pushed a commit to larroy/mxnet that referenced this pull request Sep 28, 2019
* add higher order support for sinh cosh

* add relevant tests

* update comments

* retrigger CI
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants