-
Notifications
You must be signed in to change notification settings - Fork 74k
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
TensorFlow eager execution API give a wrong answer for some function #20116
Comments
If I change math.pow function with this one then TensorFlow eager execution will give the right answer: def f3(x, n):
rst = 1
for i in range(n):
rst *= x
return rst It seems that TensorFlow eager execution API can't deal with math.pow function. I had tested tf.pow and numpy.power function. I found that TensorFlow eager execution API can't cope with this kind of functions as well. |
import tensorflow as tf
tf.enable_eager_execution()
def dp1_f1(x):
return 64*x*(1-x)*(tf.pow((1-2*x),2) )*tf.pow((1-8*x+8*x*x), 2)
def dp_numeric_diff(x):
delta_x = 0.0001
return (dp1_f1(x+delta_x)-dp1_f1(x))/delta_x
grad = tf.contrib.eager.gradients_function(dp1_f1)
print(dp_numeric_diff(3.0).numpy()) # Prints -75300000.0
print(grad(3.0)[0].numpy()) # Prints -75279680.0 |
Thanks! @asimshankar My TensorFlow version is 1.9rc0 CPU version. I had git clone the latest source code of TensorFlow and compiled the CPU version. |
@yt7589 - do you see the same issue if you use the release binaries of 1.9.0-rc0? (Because I don't :) |
@asimshankar I had not used binary release of 1.9.0-rc0. Because my CPU doesn't support AVX instruction set. |
Nagging Assignee @asimshankar: It has been 15 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
@yt7589 : Seems like the problem isn't reproducible on the release binaries of TensorFlow (last I tried was with the final 1.9.0 release). So I'm at a bit of a loss without more detail on your setup. Thanks. |
It has been 14 days with no activity and the |
Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks! |
Why TensorFlow eager execution API give a wrong answer for this function?
I want to get dy/dx value. I can get this value by numeric method just as below:
I use TensorFlow eager execution API to calculate this value:
I call this function with code below:
It will display something like this:
I am sure that the numeric method is right. What's wrong with my TensorFlow eager execution code? By the way the same TensorFlow eager execution code can get correct answer for simple function like x^2.
The text was updated successfully, but these errors were encountered: