The problem is that your test values are no longer consistent with each other.
On Fri, Mar 24, 2017, Maxim Kochurov wrote:
> Hi, I'm trying to get gradient wrt shared variable after setting new value
> and get an error. Am I doing something wrong?
> Minimal example to play with
>
> from theano import theano, tensor as tt
> abc = tt.fvector()
> abc.tag.test_value = np.array([1.,2.,3.], dtype='float32')
> X = theano.shared(np.ones((4,3), 'float32'))
> y = tt.dot(X, abc)
> X.set_value(np.ones((1, 3), 'float32'))
> y.sum().eval({abc:np.array([1.,2.,3.], dtype='float32')}) # works
> g = theano.grad(y.sum(), X)
>
> ...
>
> ValueError: shapes (3,1) and (4,) not aligned: 1 (dim 1) != 4 (dim 0)
>
>
> theano.version 0.9.0.dev-dded8355679b510acf392ce35753cbc7856ba69f
>
> --
>
> ---
> 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 theano-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Pascal
--
---
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 theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.