Any idea why this code is not working?

import theano
from theano import tensor
from theano import shared
from theano import function
import numpy as np

x=tensor.ivector('x')

def step(u_t):


h=u_t*1 

return h

[h], _ = theano.scan(step , sequences=[x])

f=function([x],[h])

b=[1,2,3,4,5,6]
print(f(b))

*Error is: *

Traceback (most recent call last):
  File "Test1.py", line 31, in <module>
    [h], _ = theano.scan(step , sequences=x)
  File "/usr/local/lib/python2.7/dist-packages/theano/tensor/var.py", line 
596, in __iter__
    for i in xrange(theano.tensor.basic.get_vector_length(self)):
  File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", 
line 4685, in get_vector_length
    raise ValueError("length not known: %s" % msg)
ValueError: length not known: for{cpu,scan_fn} [id A] ''   
 |Subtensor{int64} [id B] ''   
 | |Shape [id C] ''   
 | | |Subtensor{int64::} [id D] 'x[0:]'   
 | |   |x [id E]
 | |   |Constant{0} [id F]
 | |Constant{0} [id G]
 |Subtensor{:int64:} [id H] ''   
 | |Subtensor{int64::} [id D] 'x[0:]'   
 | |ScalarFromTensor [id I] ''   
 |   |Subtensor{int64} [id B] ''   
 |Subtensor{int64} [id B] ''   

Inner graphs of the scan ops:

for{cpu,scan_fn} [id A] ''   
 >Elemwise{mul,no_inplace} [id J] ''   
 > |x[t] [id K] -> [id H]
 > |TensorConstant{1} [id L]




-- 

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