On Fri, May 05, 2017, Gilles Degottex wrote:
> Sorry, slight confusion, by "chose the order arbitrarily" I didn't mean on 
> the fly. I meant be able to selection what ever order, but once for all 
> once running.
> I'm not actually changing anything once compiled.

Then it should work fine.

> 
> 
> 
> On Friday, 5 May 2017 02:56:03 UTC+1, Adam Becker wrote:
> >
> > I don't think this works. The inner function of scan will be converted to 
> > a graph, then getting compiled inside ScanOp. If you change nonlocal 
> > variable "order" on the fly, the change won't be reflected on the compiled 
> > function.
> >
> > If the inner loop itself can be written as scan, you can just make a 
> > nested scan instead. Compile the innermost graph with scan first (by hand), 
> > then pass it as fn to the outer scan.
> >
> > On Wednesday, May 3, 2017 at 8:04:46 PM UTC+8, Gilles Degottex wrote:
> >>
> >> Hi,
> >>
> >> I'm new on this list, so I hope I'm not duplicating a subject that has 
> >> already been covered and answered.
> >>
> >> I'm trying to implement High-Order RNN (https://arxiv.org/abs/1605.00064) 
> >> and I would like to let me chose the order arbitrarily, which changes the 
> >> number parameters to pass to the inner scan function.
> >> For this purpose, I'm doing something like:
> >>
> >>     def step(in_t, *args):
> >>
> >>         W_xi_ = args[-2]
> >>         b_i_ = args[-1]
> >>         args = args[:-2]
> >>
> >>         h_t = T.dot(in_t, W_xi_)
> >>
> >>         for p in xrange(order):
> >>             h_t += T.dot(args[p], args[order+p])
> >>
> >>         h_t = nonlinearity(h_t + b_i_)
> >>
> >>         return h_t
> >>
> >>     h, _ = theano.scan(step, sequences=[invalues],
> >>             outputs_info=[dict(initial=hid_init, taps=range(-order,0))],
> >>             non_sequences=W_hip+[W_xi, b_i], strict=True)
> >>
> >> W_hip being a list of shared matrices, one for each tap.
> >>
> >> Basically, it compiles, I can train such a model, so it looks like it 
> >> works.
> >>
> >> However, I've strictly no clue if the code is doing what I'm expecting it 
> >> to do.
> >> Is is okay to use a for loop in th inner scan function?
> >> Does scan behave nicely with a variable number of argument?
> >>
> >> Any tips to help verifying/checking that a code is doing what it is 
> >> supposed to do is also very welcome.
> >>
> >> Cheers,
> >>
> >>
> >>
> 
> -- 
> 
> --- 
> 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.

Reply via email to