Hi, I got the expected result [1., 8., 3.] on my machine, on both cpu/gpuarray backend.
The gradient override feature requires theano 0.9rc1 or later. What's your version installed? Also, you may want to give inline=True at constructor since OpFromGraph does not support GPU only graph when not inline. It's still very experimental. On Monday, April 24, 2017 at 5:28:44 PM UTC+8, Bohan Zhuang wrote: > > I run the example code from theano tutorial > http://deeplearning.net/software/theano/library/compile/opfromgraph.htm > <http://deeplearning.net/software/theano/library/compile/opfromgraph.html>l > > But it appears that theano.OpFromGraph does not take any effect... > > from theano import function, OpFromGraph, tensor, gradx, y, z = > tensor.scalars('xyz')e = x + y * zdef rescale_dy(inps, grads): > x, y, z = inps > g, = grads > return z*2op = OpFromGraph( > [x, y, z], [e], grad_overrides=['default', rescale_dy, 'default'])e2 = > op(x, y, z)dx, dy, dz = grad(e2, [x, y, z])fn = function([x, y, z], [dx, dy, > dz]) > > print fn(2.,3.,4.) > > *My output is [1.,4.,3.] rather than [1.,8.,3.] as being shown in the > tutorial.* Could anyone give an explain on that?? > > -- --- You received this message because you are subscribed to the Google Groups "theano-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
