google / tangent

Source-to-Source Debuggable Derivatives in Pure Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError in tangent.grad for array method.

jkitchin opened this issue · comments

This may be related to issue #18

def f(x):
    return x.sum()

df = tangent.grad(f)

but it raises a different kind of error:

TypeError: unhashable type: 'numpy.ndarray'

This works fine:

def f(x):
    return np.sum(x)

df = tangent.grad(f)
print df(np.array([1, 2, 3]))

#+RESULTS:
:RESULTS:
[1 1 1]

Duplicate of #18