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秒寫道:
>
> <Elemwise{Cast{int32}}> isn't a type. This is show what computation is
> done, not the type.
>
> Fred
>
> On Wed, Jul 17, 2013 at 12:07 PM Frédéric Bastien <[email protected]
> <javascript:>> wrote:
>
>> 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
>>
>>
>> On Wed, Jul 17, 2013 at 11:41 AM, Petros Ypsilantis <[email protected]
>> <javascript:>> 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 [email protected] <javascript:>.
>>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.