Error because of Theano and NumPy variable types Error because of Theano and NumPy variable types numpy numpy

Error because of Theano and NumPy variable types


I had a similar error and was able to resolve it by adding a .theanorc file containing the following two lines:

[global]floatX = float32

That seemed to fix everything. However, your problem shows a slightly different error. But I think it's worth trying.


This answer comes from Theano-users google group.

You define your x variable as:

x=T.vector(dtype=theano.config.floatX)

This is it is a vector(i.e. it only have 1 dimensions).

x_inp = np.matrix('2;1',dtype=dt)

create a matrix, not a vector.

Theano graph are strongly typed, you must defined the good number ofdimensions. Just use:

x_inp = np.asarray([2,1]) 

I actually ended up defining x and b as matrices.


Error looks quite self-explanatory; have you tried:

dt = np.dtype(np.float32) 

??