You probably declared your symbolic variable y (which you are using in
`givens`) as tensor.ivector(), which is a vector of int32, but your data
seems to contain float64 arrays.

On Tue, Nov 01, 2016, mw3...@columbia.edu wrote:
> 
> 
> I am having the same type of error here, and I am still confused about how to 
> solve this problem after reading the existing discussion. Hope to get some 
> help,thanks!
> 
> 
> test_model = theano.function(
>     inputs=[index],
>     outputs=classifier.errors(y),
>     givens={
>         x: test_set_x[index * batch_size: (index + 1) * batch_size],
>         y: test_set_y[index * batch_size: (index + 1) * batch_size]
>         }
>     )
> 
> 
> Error:
> 
> Cannot convert Type TensorType(float64, vector) (of Variable 
> Subtensor{int64:int64:}.0) into Type TensorType(int32, vector). You can try 
> to manually convert Subtensor{int64:int64:}.0 into a TensorType(int32, 
> vector).
> 
> 
> -------
> 
> x = np.array(inputD,dtype = 'float64')
> y = np.array(y,dtype = 'float64')
> y = y.flatten()
> 
> 
> train_set_x = x[:230]
> valid_set_x = x[231:280]
> test_set_x = x[281:310]
> train_set_y = y[:230]
> valid_set_y = y[231:280]
> test_set_y = y[281:310]
> 
> 
> train_set_x = theano.shared(train_set_x)
> train_set_y = theano.shared(train_set_y)
> test_set_x = theano.shared(test_set_x)
> test_set_y = theano.shared(test_set_y)
> 
> 
> print (test_set_x.type )
> print (test_set_y.type )
> 
> 
> I get:
> 
> TensorType(float64, matrix)
> TensorType(float64, vector)
> 
> -----
> 
> 
> 
> On Wednesday, July 17, 2013 at 11:41:51 AM UTC-4, Petros Ypsilantis wrote:
> >
> > Hello everyone!
> >
> > I am new to Theano and have just started working through the tutorial 
> > here: http://deeplearning.net/tutorial/logreg.html Thanks to the authors 
> > for writing the tutorial! It has been very instructive!
> >
> > My problem is that I use the code from the tutorial "logistic_sgd.py" and 
> > I have the below error message :
> >
> >
> > WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas. Falling 
> > back on slower implementations (libblas.so: cannot open shared object file: 
> > No such file or directory)
> > .... loading data
> > ...building the model
> > Traceback (most recent call last):
> >   File "/home/petros/LogReg.py", line 271, in <module>
> >     sgd_optimization_mnist()                                              
> >   File "/home/petros/LogReg.py", line 163, in sgd_optimization_mnist
> >     y: test_set_y[index * batch_size: (index + 1) * batch_size]})
> >   File 
> > "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line 
> > 221, in function
> >     profile=profile)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 484, in pfunc
> >     no_default_updates=no_default_updates)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 241, in rebuild_collect_shared
> >     cloned_v = clone_v_get_shared_updates(outputs, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 93, in clone_v_get_shared_updates
> >     clone_a(v.owner, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 132, in clone_a
> >     clone_v_get_shared_updates(i, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 93, in clone_v_get_shared_updates
> >     clone_a(v.owner, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 132, in clone_a
> >     clone_v_get_shared_updates(i, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 93, in clone_v_get_shared_updates
> >     clone_a(v.owner, copy_inputs_over)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
> > line 136, in clone_a
> >     strict=rebuild_strict)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/gof/graph.py", line 
> > 213, in clone_with_new_inputs
> >     new_inputs[i] = curr.type.filter_variable(new)
> >   File "/usr/local/lib/python2.7/dist-packages/theano/tensor/basic.py", 
> > line 821, in filter_variable
> >     self=self)
> > TypeError: Cannot convert Type TensorType(int32, matrix) (of Variable 
> > Subtensor{int64:int64:}.0) into Type TensorType(int32, vector). You can try 
> > to manually convert Subtensor{int64:int64:}.0 into a TensorType(int32, 
> > vector).
> >
> >
> >
> > Does anyone know how to solve this problem.....???
> >
> > Thanks in advance.
> >
> > Petros
> >
> 
> -- 
> 
> --- 
> 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