I was able to solve the problem. I wrote the shared variables in givens.
Also the asarray part of the code snippet was semantically incorrect. It
should be
W_l12_values=np.asarray(rng.uniform(-1,1,(3,4)))
On Thursday, September 8, 2016 at 1:32:32 AM UTC+5:30, Mohit wrote:
>
> On using a combination of fvector and shared variables I get a missing
> input error. The expression is:
>
> y=T.dot(T.nnet.sigmoid(T.dot(x,W_l12)+b_l2),W_l23)+b_l3
>
> and used
>
> f=theano.function([x],y)
>
> Error message:
> theano.gof.fg.MissingInputError: ("An input of the graph, used to compute
> dot(x, W_l12), was not provided and not given a value.Use the Theano flag
> exception_verbosity='high',for more information on this error.", W_l12)
>
> The code snippet is:
>
> learning_rate=T.fscalar('learning_rate')
> y_desired=T.fvector('y_desired')
> y_desired=theano.shared(value=y_value,name='y_desired',borrow=True)
> rng=np.random.RandomState(1234)
> W_l12_values=np.asarray(2*rng.uniform(3,4)-1)
> W_l23_values=np.asarray(2*rng.uniform(4,1)-1)
> b_l2_values=np.asarray(rng.uniform(4,1))
> b_l3_values=np.asarray(rng.uniform(1,1))
> W_l12=theano.shared(value=W_l12_values,name='W_l12',borrow=True)
> W_l23=theano.shared(value=W_l23_values,name='W_l23',borrow=True)
> b_l2=theano.shared(value=b_l2_values,name='b_l2',borrow=True)
> b_l3=theano.shared(value=b_l3_values,name='b_l3',borrow=True)
> W_l12,W_l23,b_l2,b_l3=T.fmatrices('W_l12','W_l23','b_l2','b_l3')
> params=[W_l12,W_l23,b_l2,b_l3]
> x=T.fvector('x')
> y=T.dot(T.nnet.sigmoid(T.dot(x,W_l12)+b_l2),W_l23)+b_l3
> cost=T.sqr(y-y_desired).sum()
> gparams=[T.grad(cost,gf) for gf in params]
> updates=[(params,params-learning_rate*gparams) for gf,gp in
> zip(params,gparams)]
> f=function([x],y)
>
--
---
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.