cgt icon indicating copy to clipboard operation
cgt copied to clipboard

Simple operation breaks CGT

Open EdsterG opened this issue 8 years ago • 0 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]

EdsterG avatar Mar 31 '16 22:03 EdsterG