Is there a way to pass different sizes matrices as a sequence in 
theano.scan()? For instance

X3 = T.tensor3(name='X3', dtype=theano.config.floatX)

theta = theano.shared(name='theta_temp',
    value=np.array([0.1, 0.2, 0.3],
       dtype=theano.config.floatX))

x_temp = np.array([[[1, 2, 3],
   [4, 5, 6], 
   [7, 8, 9]],
  [[2, 3, 6],
   [4, 7, 0],
   [0, 0, 1]]])

y_temp = np.array([[[1, 2, 3],
    [4, 5, 6], 
    [7, 8, 9]],
   [[2, 3, 6],
    [4, 7, 0]]])

def foo(inputs):
hyp = T.dot(inputs, theta.T)

return hyp

results, _ = theano.scan(fn=cost2,
        sequences=[X3])

f = theano.function(inputs=[X3], outputs=results,
       allow_input_downcast=True)

print(f(x_temp)) # This works 
print('----------')
print(f(y_temp)) # This does not work

I noticed that `x_temp` works every entry is of the same size, whereas 
`y_temp` will yield an error, namely

ValueError: ('Bad input argument to theano function with name 
"C:\\...\\Linear_Regression_theano_test.py:144"  at index 0(0-based)', 
'setting an array element with a sequence.')

now the only difference between `x_temp` and `y_temp` is that the last 
matrix in `y_temp` is of size `2x3` instead of `3x3` and this seems to be 
causing a problem. 


-- 

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