Re: [theano-users] Re: Input error(extra dimensions) at theano.function

2016-09-07 Thread Ganesh Iyer
Man I made a whole lot of changes today. This was a siamese architecture 
and I just wanted a scalar score of comparison at the end. Having no 
trouble with it so far. With respect to input what I mainly did was 
reshaping it to 4d at the start itself and reuse the variable

The current code:
http://pastebin.com/mumczScn

On Thursday, 8 September 2016 01:18:01 UTC+5:30, nouiz wrote:
>
> I'm still not sure you are computing what you have in mind. See Theano 
> tutorial on how to print theano graph.
>
> On Wed, Sep 7, 2016 at 3:40 PM, Ganesh Iyer  > wrote:
>
>> Ya reshaping the same variable worked somehow. 
>>
>> Thanks Anyways :)
>>
>> On Thu, Sep 8, 2016 at 12:29 AM, Frédéric Bastien > > wrote:
>>
>>> When you call theano.funciton, the inputs you give should correspond to 
>>> the inputs when you call.
>>>
>>> You have a problem in your code in the part that build the multiple 
>>> layers. You define input_left as a matrix, but later you override it to be 
>>> a 4d tensor at line 295. This also make that your compiled function don't 
>>> have multiple layers...
>>>
>>> You must keep the original matrix variable and not override it.
>>>
>>> Fred
>>>
>>> On Wed, Sep 7, 2016 at 2:22 AM, Ganesh Iyer >> > wrote:
>>>
 Okay so I figured a workaround. But just wanted to know if I'm using 
 dmatrices why should it expect a 4 dimensional input.

 --

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

>>>
>>> -- 
>>>
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "theano-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/theano-users/eOFITlIDUOI/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> theano-users...@googlegroups.com .
>>> 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 theano-users...@googlegroups.com .
>> 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 theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [theano-users] Re: Input error(extra dimensions) at theano.function

2016-09-07 Thread Ganesh Iyer
Ya reshaping the same variable worked somehow.

Thanks Anyways :)

On Thu, Sep 8, 2016 at 12:29 AM, Frédéric Bastien <
frederic.bast...@gmail.com> wrote:

> When you call theano.funciton, the inputs you give should correspond to
> the inputs when you call.
>
> You have a problem in your code in the part that build the multiple
> layers. You define input_left as a matrix, but later you override it to be
> a 4d tensor at line 295. This also make that your compiled function don't
> have multiple layers...
>
> You must keep the original matrix variable and not override it.
>
> Fred
>
> On Wed, Sep 7, 2016 at 2:22 AM, Ganesh Iyer  wrote:
>
>> Okay so I figured a workaround. But just wanted to know if I'm using
>> dmatrices why should it expect a 4 dimensional input.
>>
>> --
>>
>> ---
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "theano-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/theano-users/eOFITlIDUOI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> theano-users+unsubscr...@googlegroups.com.
> 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 theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [theano-users] Re: Input error(extra dimensions) at theano.function

2016-09-07 Thread Frédéric Bastien
When you call theano.funciton, the inputs you give should correspond to the
inputs when you call.

You have a problem in your code in the part that build the multiple layers.
You define input_left as a matrix, but later you override it to be a 4d
tensor at line 295. This also make that your compiled function don't have
multiple layers...

You must keep the original matrix variable and not override it.

Fred

On Wed, Sep 7, 2016 at 2:22 AM, Ganesh Iyer  wrote:

> Okay so I figured a workaround. But just wanted to know if I'm using
> dmatrices why should it expect a 4 dimensional input.
>
> --
>
> ---
> 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+unsubscr...@googlegroups.com.
> 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 theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[theano-users] Re: Input error(extra dimensions) at theano.function

2016-09-06 Thread Jesse Livezey
Your inputs should be tensor4 rather than matrix if you're passing them 
into a CNN.

On Tuesday, September 6, 2016 at 7:22:38 AM UTC-7, Ganesh Iyer wrote:
>
>  
> Hi guys, 
>
> I'm new to this group and theano in general. I'm trying to send 2 image 
> patches, greyscale ( 2D numpy arrays of size (9,9) using cv2.imread(name,0) 
> ) through a CNN architecture. I'm giving these as inputs to theano.function.
>
> train_set_left=np.float64(train_set_left)
> train_set_right_positive=np.float64(train_set_right_positive)
>
> train_model=theano.function(inputs=[input_left,input_right] 
> ,outputs=[s_plus])
> print(train_model(train_set_left,train_set_right_positive))
>
> The error I get at this point is:
>
> at index 0(0-based)', 'Wrong number of dimensions: expected 4, got 2 with 
> shape (9, 9).')
>
>
> input_left and input_right are defined earlier in the code as:
>
> input_left=T.dmatrix('input_left')
> input_right=T.dmatrix('input_right')
>
> Is there something wrong with the input dimensions in this case?
>
> Full Code: http://pastebin.com/33fTyb3K
> The code itself is based on the LeNet tutorial, but is a bit messy. 
>
> Please Help.
>

-- 

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.