pyautodiff icon indicating copy to clipboard operation
pyautodiff copied to clipboard

Wrong result from example in the docs if integer args

Open ggventurini opened this issue 9 years ago • 0 comments

Hi,

I am trying out pyautodiff and I ran into the following problem:

from autodiff import gradient

@gradient
def f(x):
    return x**2

print(f(100))

Prints out:

0.0

Which is wrong.

Instead if I call print(f(100.)) -- notice the dot, which makes the argument a float -- I get the correct result:

200.0

Am I missing something? Am I doing something wrong?

Thanks for all the good work!

GV


System information:

  • Python 3.3.5 |Anaconda 1.9.1 (x86_64)| (default, Sep 2 2014, 13:57:31)
  • pyautodiff from the python3 branch, up to date (HEAD 7973e26f1c233570ed4bb10d08634ec7378e2152)
  • Theano 0.7.0
  • Numpy 1.9.2
  • Meta 0.4.1

ggventurini avatar May 10 '15 06:05 ggventurini