lisa-groundhog / GroundHog

Library for implementing RNNs with Theano
BSD 3-Clause "New" or "Revised" License
598 stars 229 forks source link

errors with scan: got an unexpected keyword argument 'states' at tutorials/DT_RNN_Tut.py #51

Open lionheartxlw opened 8 years ago

lionheartxlw commented 8 years ago

I am using theano0.7. I got the following error from the tutorial.

TypeError: scan() got an unexpected keyword argument 'states'

Can anyone kindly help me? Thanks.

file: tutorials/DT_RNN_Tut.py line: 235

scan for iterating the single-step sampling multiple times
[samples, summaries], updates = scan(sample_fn,
                  states = [
                      TT.alloc(numpy.int64(0), state['sample_steps']),
                      TT.alloc(numpy.float32(0), 1, eval(state['nhids'])[-1])],
                  n_steps= state['sample_steps'],
                  name='sampler_scan')
nouiz commented 8 years ago

This example used an old interface to scan. I'm not sure how to convert it. @lamblin, do you remember?

On Wed, Mar 16, 2016 at 4:51 AM, lionheartxlw notifications@github.com wrote:

I am using theano0.7. I got the following error from the tutorial.

TypeError: scan() got an unexpected keyword argument 'states'

Can anyone kindly help me? Thanks.

file: tutorials/DT_RNN_Tut.py line: 235

scan for iterating the single-step sampling multiple times

[samples, summaries], updates = scan(sample_fn, states = [ TT.alloc(numpy.int64(0), state['sample_steps']), TT.alloc(numpy.float32(0), 1, eval(state['nhids'])[-1])], n_steps= state['sample_steps'], name='sampler_scan')

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/lisa-groundhog/GroundHog/issues/51

lamblin commented 8 years ago

You would need to use import scan from theano.scan_module instead of sandbox. Then use outputs_info instead of states, and the syntax is a bit different in that you only specify the initial state, instead of the whole buffer. Then, you may need to keep only the requested number of steps you want to keep. For instance, for your second state (summaries), you will want to only keep summaries[-1].