What if the training_y is a (500,3) matrix, with corresponding layer0 data structure (500, 3, h, w) or training_x a (500, 3*h*w) matrix?
On Wednesday, December 30, 2015 at 3:03:21 AM UTC-8, Daniel Renshaw wrote: > > My guess is your training_y is a matrix but the Theano code is expecting > it to be a vector. If you're basing this on MNIST then training_y should be > a vector of integers where the integer values indicate which class each > training instance actually belongs to. > > On 30 December 2015 at 09:55, mukul arora <[email protected] > <javascript:>> wrote: > >> I am trying to work out CNN code in theano for my dataset, i have tried >> to maintain analogy to shape of MNIST database in python and getting the >> following error >> >> File "/home/mukul_arora/Documents/gipedi/cnnNetwork2.py", line 102, in >> SGD >> training_y[i*self.mini_batch_size : (i+1)*self.mini_batch_size] >> File >> "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line >> 266, in function >> profile=profile) >> File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", >> line 489, 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 92, 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 131, 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 92, 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 131, 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 92, 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 131, 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 92, 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 131, 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 92, 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 131, 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 92, 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 131, 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 92, 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 131, 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 92, 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 135, in clone_a >> strict=rebuild_strict) >> File "/usr/local/lib/python2.7/dist-packages/theano/gof/graph.py", line >> 211, in clone_with_new_inputs >> new_inputs[i] = curr.type.filter_variable(new) >> File "/usr/local/lib/python2.7/dist-packages/theano/tensor/type.py", >> line 218, 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). >> >> >> Can anyone suggest method to rectify it? >> >> -- >> >> --- >> 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/d/optout. >> > > -- --- 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.
