Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Fix tf.pow() gradient to use power rule instead of dividing by x (which can be 0). #1376

Merged
merged 1 commit into from
Nov 5, 2018

Conversation

nsthorat
Copy link
Contributor

@nsthorat nsthorat commented Nov 5, 2018

This change is Reviewable

@nsthorat nsthorat requested a review from dsmilkov November 5, 2018 16:53
@nsthorat nsthorat changed the title Fix pow gradients for x ^ 2, x = 0. Fix tf.pow() gradient to use chain rule instead of dividing by x (which can be 0). Nov 5, 2018
@nsthorat nsthorat changed the title Fix tf.pow() gradient to use chain rule instead of dividing by x (which can be 0). Fix tf.pow() gradient to use power rule instead of dividing by x (which can be 0). Nov 5, 2018
Copy link
Contributor

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @dsmilkov)

@nsthorat nsthorat merged commit df443ea into master Nov 5, 2018
@nsthorat nsthorat deleted the pow branch November 5, 2018 17:59
nsthorat pushed a commit that referenced this pull request Jan 4, 2019
BUG
#### Description
<!--
Please describe the pull request here.
Also, if this is an issue/bug fix, please add the issue link for reference here.
-->
Multiple problems with the gradient for pow were brought up in tensorflow/tfjs#346.  One was fixed by #1376, the other is that the gradient with respect to the exponent is nan when the base is negative.  This differs from TF which returns 0 in this case: /~https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/math_grad.py#L1046

---
<!-- Please do not delete this section -->
##### For repository owners only:

Please remember to apply all applicable tags to your pull request.
Tags: FEATURE, BREAKING, BUG, PERF, DEV, DOC, SECURITY

For more info see: /~https://github.com/tensorflow/tfjs/blob/master/DEVELOPMENT.md

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/tensorflow/tfjs-core/1446)
<!-- Reviewable:end -->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants