joschu / cgt

Computation Graph Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple operation breaks CGT

EdsterG opened this issue · comments

The following code doesn't work:

x = np.array([31,-2])
K = np.array([[3,5],[7,11],[13,17]])

_x = cgt.vector(fixed_shape=[2], name="x")
_K = cgt.matrix(fixed_shape=[3,2], name="K")

grad_K = cgt.grad(_K.dot(_x)[0], _K)
grad_K_x = cgt.grad(grad_K[0,0], _x)
f_K_x = cgt.function([_x, _K], grad_K_x)
print f_K_x(x,K) # should be [1,0]