Thanks a lot

2016-09-30 10:16 GMT+08:00 Pascal Lamblin <[email protected]>:

> On Fri, Sep 30, 2016, 杨培 wrote:
> > Thanks。
> > As your answer。 The problem is I ignore the update dictionary returned by
> > theano scan。
> > Here,I have a new question。
> > In my program,this code is in another scan loop, and I have used the
> update
> > dictionary for the outter scan loop。
> > So,how I can past the update dictionary of RandomStream to theano
> function
> > method。
>
> In the step function of the outer loop, return the updates dictionary
> coming from the inner scan.
> Then, pass the updates dictionary coming from the outer scan to
> theano.function.
>
> >
> > 2016-09-30 5:57 GMT+08:00 Pascal Lamblin <[email protected]>:
> >
> > > Also, never ignore the updates returned by theano.scan!
> > > In other words, always do:
> > >
> > > result, updates = theano.scan(...)
> > > f = theano.function(..., updates=updates)
> > >
> > > and never:
> > >
> > > result, _ = theano.scan(...)
> > >
> > > On Thu, Sep 29, 2016, 杨培 wrote:
> > > > When I use theano loop with RandomStream to generate random number,
> > > >  theano compile fail with “MissingInput”。
> > > >
> > > > I Google this problem, and I found :
> > > >
> > > >    - a  issue(https://github.com/Theano/Theano/issues/3437)。This
> issue
> > > said
> > > >    we cannot use RandomStream with symbolic shape in scan。
> > > >
> > > > But I also found :
> > > >
> > > >    - a documentation int Theano
> > > >    (http://deeplearning.net/software/theano/library/scan.
> > > html#using-shared-variables-gibbs-sampling),the
> > > >    code in the documentation use RandomStream with symbolic shape in
> > > scan。
> > > >
> > > > So,how to use theano scan with RandomStream。Thanks for your help
> > > >
> > > > here is my code。this code compile failed
> > > >
> > > >
> > > >    - import theano;
> > > >    - from theano import tensor as T;
> > > >    - import numpy as np;
> > > >    -
> > > >    - from theano.sandbox.rng_mrg import MRG_RandomStreams as
> > > RandomStreams;
> > > >    -
> > > >    - x=T.ivector();
> > > >    -
> > > >    - def step(i):
> > > >    -     sample=RandomStreams().binomial(size=(i,));
> > > >    -     return sample;
> > > >    -
> > > >    - result,_=theano.scan(fn=step,outputs_info=None,
> > > >    -                      sequences=[x]);
> > > >    -
> > > >    - f=theano.function([x],result);
> > > >    -
> > > >    - x_val=np.array([1,2,3],dtype='int32');
> > > >    - print f(x_val);
> > > >
> > > >
> > > > this code work fine
> > > >
> > > >    - import theano;
> > > >    - from theano import tensor as T;
> > > >    - import numpy as np;
> > > >    -
> > > >    - from theano.sandbox.rng_mrg import MRG_RandomStreams as
> > > RandomStreams;
> > > >    -
> > > >    - x=T.ivector();
> > > >    - len=x.shape[0];
> > > >    -
> > > >    - def step(i):
> > > >    -     len_=len;
> > > >    -     sample=RandomStreams().binomial(size=(len_,));
> > > >    -     return sample;
> > > >    -
> > > >    - result,_=theano.scan(fn=step,outputs_info=None,
> > > >    -                      sequences=[x]);
> > > >    -
> > > >    - f=theano.function([x],result);
> > > >    -
> > > >
> > > >
> > > >    - x_val=np.array([1,2,3],dtype='int32');
> > > >    - print f(x_val);
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > ---
> > > > 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.
> > >
> > >
> > > --
> > > Pascal
> > >
> > > --
> > >
> > > ---
> > > You received this message because you are subscribed to a topic in the
> > > Google Groups "theano-users" group.
> > > To unsubscribe from this topic, visit https://groups.google.com/d/
> > > topic/theano-users/InLNaYdIxak/unsubscribe.
> > > To unsubscribe from this group and all its topics, send an email to
> > > [email protected].
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> >
> > ---
> > 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.
>
> --
> Pascal
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "theano-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/theano-users/InLNaYdIxak/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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.

Reply via email to