-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff][TF-1200] Adding derivatives for stdlib pow
function.
#30580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1a7caab
to
44d1a49
Compare
@@ -38,17 +38,40 @@ func expectEqualWithTolerance<T>(_ expected: TestLiteralType, _ actual: T, | |||
file: file, line: line) | |||
} | |||
|
|||
func computeDividedDifference<T: BinaryFloatingPoint> ( |
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.
I tried to use instead symmetric derivative formula to compute the numerical derivative, which gives a more precise result hence allowing to use lower values for ulps
but some test cases for reminder
broke, hence I dropped that change, but maybe we should use it in the future.
|
||
// pow | ||
let eps:${T} = 0.01 | ||
let ulps:${T} = eps/eps.ulp |
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.
here I compute the needed ulps
for comparing values as the resulting numerical derivative depends on the ε used to compute it.
hello @dan-zheng, sorry that it took me this long to address your comments but I finally had time this weekend to address them. I needed to rebase my PR due to conflicts, so I did :/. |
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 have moved most of differentiation to the master
branch now! Could you change this PR to be against the master
branch? I think that it should rebase pretty cleanly now.
Adding JVP and VJP function derivatives for `pow` function defined in stdlib. Resolves TF-1200.
The versions of VJP and JVP match the results that TensorFlow woudl give. As well, this extends the test cases to include combinations of positive and negative values and corner cases.
We now have 3 sections for the tests: negative base, 0 base and positive base.
pow
function.pow
function.
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.
Thanks, looks good now! Sorry, it took me a while to notice this.
I'll run tests and if they're green, I'll merge!
@swift-ci please test |
No worries @marcrasi, thanks! |
@swift-ci please test |
…iftlang#30580) Adding JVP and VJP function derivatives for pow function defined in stdlib. Resolves TF-1200.
Adding JVP and VJP function derivatives for
pow
functiondefined in stdlib.
Resolves TF-1200.