Discussion:
[theano-users] Re: TypeError: Cannot convert Type TensorType(int32, matrix) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(int32, vector).
bansari shah
2015-01-20 06:31:25 UTC
Permalink
Hi,

I am facing the same problem. But adding this import doesn't help me. Can
someone please suggest something else?
Hi,
Finally, I figure out that it was the missing library "scipy.linalg.blas"
that causes the specific problem.
I just import the specific library and the program "logistic_sgd.py" is
running normally
Petros.
΀η ΀ετάρτη, 17 Ιουλίου 2013 6:41:51 ÎŒ.ÎŒ. UTC+3, ο χρήστης Petros
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
WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas. Falling
No such file or directory)
.... loading data
...building the model
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal Lamblin
2015-01-20 17:56:20 UTC
Permalink
Post by bansari shah
I am facing the same problem. But adding this import doesn't help me. Can
someone please suggest something else?
Which problem exactly?
The warning message regarding blas?
Or the TypeError?

Also, did you modify the tutorial at all?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jannicke Ps
2015-05-08 00:28:32 UTC
Permalink
I modified the tutorial to read in from a .csv file. I think the problem is
the I am importing test_set_y as an np.array which automatically creates a
matrix instead of a vector?

test_raw = list(csv.reader(open("../training.csv","rb"), delimiter=','))
test_raw_y = np.array([map(str, row[-1]) for row in
test_raw[int(0.8*num_rows):int(num_rows)]])
test_raw_y = np.where(test_raw_y == 's', 1,0)

I also get a warning about fblas

DeprecationWarning: Module scipy.linalg.blas.fblas is deprecated, use
scipy.linalg.blas instead DeprecationWarning)
Post by Pascal Lamblin
Post by bansari shah
I am facing the same problem. But adding this import doesn't help me.
Can
Post by bansari shah
someone please suggest something else?
Which problem exactly?
The warning message regarding blas?
Or the TypeError?
Also, did you modify the tutorial at all?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
JPs
2015-05-08 00:31:10 UTC
Permalink
To be more specific, I am getting the same error as the first poster:

... building the model
Traceback (most recent call last):
File "logistic_sgd.py", line 479, in <module>
sgd_optimization_mnist()
File "logistic_sgd.py", line 350, in sgd_optimization_mnist
y: test_set_y[index * batch_size: (index + 1) * batch_size]

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).
Post by Jannicke Ps
I modified the tutorial to read in from a .csv file. I think the problem
is the I am importing test_set_y as an np.array which automatically creates
a matrix instead of a vector?
test_raw = list(csv.reader(open("../training.csv","rb"), delimiter=','))
test_raw_y = np.array([map(str, row[-1]) for row in
test_raw[int(0.8*num_rows):int(num_rows)]])
test_raw_y = np.where(test_raw_y == 's', 1,0)
I also get a warning about fblas
DeprecationWarning: Module scipy.linalg.blas.fblas is deprecated, use
scipy.linalg.blas instead DeprecationWarning)
Post by Pascal Lamblin
Post by bansari shah
I am facing the same problem. But adding this import doesn't help me.
Can
Post by bansari shah
someone please suggest something else?
Which problem exactly?
The warning message regarding blas?
Or the TypeError?
Also, did you modify the tutorial at all?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
JPs
2015-05-08 16:32:31 UTC
Permalink
I fixed this error using flatten on my y np.array as described in a
different post.

I.e test_raw_y.flatten()
Post by JPs
... building the model
File "logistic_sgd.py", line 479, in <module>
sgd_optimization_mnist()
File "logistic_sgd.py", line 350, in sgd_optimization_mnist
y: test_set_y[index * batch_size: (index + 1) * batch_size]
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).
Post by Jannicke Ps
I modified the tutorial to read in from a .csv file. I think the problem
is the I am importing test_set_y as an np.array which automatically creates
a matrix instead of a vector?
test_raw = list(csv.reader(open("../training.csv","rb"), delimiter=','))
test_raw_y = np.array([map(str, row[-1]) for row in
test_raw[int(0.8*num_rows):int(num_rows)]])
test_raw_y = np.where(test_raw_y == 's', 1,0)
I also get a warning about fblas
DeprecationWarning: Module scipy.linalg.blas.fblas is deprecated, use
scipy.linalg.blas instead DeprecationWarning)
Post by Pascal Lamblin
Post by bansari shah
I am facing the same problem. But adding this import doesn't help me.
Can
Post by bansari shah
someone please suggest something else?
Which problem exactly?
The warning message regarding blas?
Or the TypeError?
Also, did you modify the tutorial at all?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@columbia.edu
2016-11-01 14:53:46 UTC
Permalink
Would you mind sharing how you fix the problem? I am having the same error,
and I also tried flatten. However it doesn't work. What is the post?
Post by JPs
I fixed this error using flatten on my y np.array as described in a
different post.
I.e test_raw_y.flatten()
Post by JPs
... building the model
File "logistic_sgd.py", line 479, in <module>
sgd_optimization_mnist()
File "logistic_sgd.py", line 350, in sgd_optimization_mnist
y: test_set_y[index * batch_size: (index + 1) * batch_size]
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).
Post by Jannicke Ps
I modified the tutorial to read in from a .csv file. I think the problem
is the I am importing test_set_y as an np.array which automatically creates
a matrix instead of a vector?
test_raw = list(csv.reader(open("../training.csv","rb"), delimiter=','))
test_raw_y = np.array([map(str, row[-1]) for row in
test_raw[int(0.8*num_rows):int(num_rows)]])
test_raw_y = np.where(test_raw_y == 's', 1,0)
I also get a warning about fblas
DeprecationWarning: Module scipy.linalg.blas.fblas is deprecated, use
scipy.linalg.blas instead DeprecationWarning)
Post by Pascal Lamblin
Post by bansari shah
I am facing the same problem. But adding this import doesn't help me.
Can
Post by bansari shah
someone please suggest something else?
Which problem exactly?
The warning message regarding blas?
Or the TypeError?
Also, did you modify the tutorial at all?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@columbia.edu
2016-11-01 15:09:18 UTC
Permalink
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)

-----
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
WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas. Falling
No such file or directory)
.... loading data
...building the model
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal Lamblin
2016-11-02 21:48:36 UTC
Permalink
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.
Post by m***@columbia.edu
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]
}
)
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 )
TensorType(float64, matrix)
TensorType(float64, vector)
-----
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
WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas. Falling
No such file or directory)
.... loading data
...building the model
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.
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Markus de Ruijter
2017-03-27 09:56:09 UTC
Permalink
You might have declared your variable as a float but are using it as an int.

From the logistic regression example on
http://deeplearning.net/tutorial/logreg.html#logreg :

shared_y = theano.shared(numpy.asarray(data_y,
dtype=theano.config.floatX),
borrow=borrow)
# When storing data on the GPU it has to be stored as floats
# therefore we will store the labels as ``floatX`` as well
# (``shared_y`` does exactly that). But during our computations
# we need them as ints (we use labels as index, and if they are
# floats it doesn't make sense) therefore instead of returning
# ``shared_y`` we will have to cast it to int. This little hack
# lets ous get around this issue
return shared_x, T.cast(shared_y, 'int32')

You can see they cast the "shared_y" variable to an integer:
T.cast(shared_y, 'int32')
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
t***@gmail.com
2017-03-28 06:44:47 UTC
Permalink
My question is, if you cast train_set_y, T.cast(train_set_y,'int32'),
doesn't it change its type from <TensorType(float64,vector)> to
<Elemwise{Cast{int32}}>? I think that's what I can't figure out.

Markus de Ruijteræ–Œ 2017幎3月27日星期䞀 UTC+8䞋午5時56分09秒寫道
Post by Markus de Ruijter
You might have declared your variable as a float but are using it as an int.
From the logistic regression example on
shared_y = theano.shared(numpy.asarray(data_y,
dtype=theano.config.floatX),
borrow=borrow)
# When storing data on the GPU it has to be stored as floats
# therefore we will store the labels as ``floatX`` as well
# (``shared_y`` does exactly that). But during our computations
# we need them as ints (we use labels as index, and if they are
# floats it doesn't make sense) therefore instead of returning
# ``shared_y`` we will have to cast it to int. This little hack
# lets ous get around this issue
return shared_x, T.cast(shared_y, 'int32')
T.cast(shared_y, 'int32')
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Frédéric Bastien
2017-03-28 12:57:18 UTC
Permalink
<Elemwise{Cast{int32}}> isn't a type. This is show what computation is
done, not the type.

Fred
Hi,
Did you modify the example? Normally it work correctly. I tested it again
and it still work here.
The problem seam to be that in the file LoReg.py, on line 163, when you
call theano.function(), the givens or the updates parameter isn't good. You
try to replace a matrix with a vector.
Fred
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
WARNING (theano.tensor.blas): Failed to import scipy.linalg.blas. Falling
No such file or directory)
.... loading data
...building the model
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
For more options, visit https://groups.google.com/groups/opt_out.
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
t***@gmail.com
2017-03-29 03:36:02 UTC
Permalink
okay, I finally sort it out.
[for all tutorials]
(1) the mnist dataset somehow doesn't split into three parts
(train_set,test_set,valid_set).
One should revise the code on deeplearning tutorial

(2) the type of train_set_x,test_set_x are 3D matrices (i.e.
TensorType(float64,3D) ), however, the declaration of x=T.matrix('x') gives
TensorType(float64,matrix)
One way to figure this out is to add two lines below the declaration of
x:
train_set_x = train_set_x.flatten().reshape((60000,28*28))
test_set_x = test_set_x.flatten().reshape((10000,28*28))

[for logistic regression tutorial]
(3) the type of train_set_y, test_set_y are Elemsie{float64}, however, the
declaration of y = T.ivector('y') is of TensorType(int32,vector)
One way to figure this out is to revise the code inside the function
shared_dataset.
Change the dtype=theano.config.floatX of shared_y to dtype='int32'

(4) If you still wish to use the mini-batch in the code,
either spit the training examples into training and validate parts or
simply set your valid_set to be test_set [if you just want the code to work]

Anyway, I guess all the changes one has to make is due the differences of
mnist data set. [maybe it has been modified, i have no idea.]

-Po

nouizæ–Œ 2017幎3月28日星期二 UTC+8䞋午8時57分31秒寫道
Post by Frédéric Bastien
<Elemwise{Cast{int32}}> isn't a type. This is show what computation is
done, not the type.
Fred
Hi,
Did you modify the example? Normally it work correctly. I tested it again
and it still work here.
The problem seam to be that in the file LoReg.py, on line 163, when you
call theano.function(), the givens or the updates parameter isn't good. You
try to replace a matrix with a vector.
Fred
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"
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
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
For more options, visit https://groups.google.com/groups/opt_out.
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bavani Sankar
2017-05-29 20:37:52 UTC
Permalink
I tried everthing you said. The same error still shows. Here is the github
link to the code:
https://github.com/Layman806/ocr-cnn/blob/master/CNN.py
The error shows up in the exact same line.
Here it is line 151.
Post by t***@gmail.com
okay, I finally sort it out.
[for all tutorials]
(1) the mnist dataset somehow doesn't split into three parts
(train_set,test_set,valid_set).
One should revise the code on deeplearning tutorial
(2) the type of train_set_x,test_set_x are 3D matrices (i.e.
TensorType(float64,3D) ), however, the declaration of x=T.matrix('x') gives
TensorType(float64,matrix)
One way to figure this out is to add two lines below the declaration
train_set_x = train_set_x.flatten().reshape((60000,28*28))
test_set_x = test_set_x.flatten().reshape((10000,28*28))
[for logistic regression tutorial]
(3) the type of train_set_y, test_set_y are Elemsie{float64}, however, the
declaration of y = T.ivector('y') is of TensorType(int32,vector)
One way to figure this out is to revise the code inside the function
shared_dataset.
Change the dtype=theano.config.floatX of shared_y to dtype='int32'
(4) If you still wish to use the mini-batch in the code,
either spit the training examples into training and validate parts or
simply set your valid_set to be test_set [if you just want the code to work]
Anyway, I guess all the changes one has to make is due the differences of
mnist data set. [maybe it has been modified, i have no idea.]
-Po
nouizæ–Œ 2017幎3月28日星期二 UTC+8䞋午8時57分31秒寫道
Post by Frédéric Bastien
<Elemwise{Cast{int32}}> isn't a type. This is show what computation is
done, not the type.
Fred
Hi,
Did you modify the example? Normally it work correctly. I tested it
again and it still work here.
The problem seam to be that in the file LoReg.py, on line 163, when you
call theano.function(), the givens or the updates parameter isn't good. You
try to replace a matrix with a vector.
Fred
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"
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
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
For more options, visit https://groups.google.com/groups/opt_out.
--
---
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...