Hi eveyone.

I am having the popular error TypeError: Cannot convert Type TensorType. I 
am not able to solve it using the help in other posts.

I am using my own database and I am using the LENET architecture.


This is my data. I read it in a different function image per image:

croped_Scale = frame[arr:abj, izq:dcha]
image = cv2.resize(croped_Scale, (128, 128))
aux_vect = np.ravel(image)
aux_X.append(aux_vect)




And then I use it in LENET:

train_set_x = theano.shared(numpy.array(train_set_x))
test_set_x = theano.shared(numpy.array(test_set_x))
train_set_y = theano.shared(numpy.array(y_train))
test_set_y = theano.shared(numpy.array(y_test))
valid_set_x = theano.shared(numpy.array(valid_set_x))
valid_set_y = theano.shared(numpy.array(y_val))



whose shape is:


(2324, 49152) (664, 49152) (332, 49152) For samples (training, test and 
validation)
(2324,) (664,) (332,) and for labels (training, test and validation)



Here is my error: TypeError: Cannot convert Type TensorType(uint8, matrix) 
(of Variable Subtensor{int64:int64:}.0) into Type TensorType(float64, 
matrix). You can try to manually convert Subtensor{int64:int64:}.0 into a 
TensorType(float64, matrix).
And the line where it is produced is in:     y: test_set_y[index * 
batch_size: (index + 1) * batch_size]


If use the flatten function in that way:

train_set_x = theano.shared(numpy.array(train_set_x).flatten())
test_set_x = theano.shared(numpy.array(test_set_x).flatten())
train_set_y = theano.shared(numpy.array(y_train).flatten())
test_set_y = theano.shared(numpy.array(y_test).flatten())
valid_set_x = theano.shared(numpy.array(valid_set_x).flatten())
valid_set_y = theano.shared(numpy.array(y_val).flatten())


I get the following error:TypeError: Cannot convert Type TensorType(uint8, 
vector) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(float64, 
matrix). You can try to manually convert Subtensor{int64:int64:}.0 into a 
TensorType(float64, matrix).

 

If I force the samples to be float64 and the labels to be int32 it works, 
but I do not want to do that because it would not work with GPU because of 
the line in theanorc: floatX = float32

I have been reading in the forum I have not get the solution.

Anyone could help me? I would like to run the code in GPU

Regards.

-- 

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