So is there a better way to perform 1X1 convolution using the conv2d module 
? Just curious. 

On Monday, October 31, 2016 at 12:53:11 PM UTC-7, Pascal Lamblin wrote:
>
>
> If you run a convolution with a (1, 1, 1, 1) filter, then you will only 
> have one output channel. That could explain why you have a shape of (1, 
> 128, 1, 2) instead of (1, 128, 128, 2). 
>
> These shapes are not compatible, and Join will not explicitly duplicate 
> cost along the broadcastable axis (neither will numpy.join). 
>
> If duplication of the cost along axis=2 is what you want, then you could 
> use 
>
> T.concatenate( 
>     [img_param[:, :, :, :3], T.alloc(cost, cost.shape[0], cost.shape[1], 
> img_param.shape[2], 2)], 
>     axis=3) 
>
> On Sun, Oct 30, 2016, Ido wrote: 
> > I'm trying to concatenate two tensors along their 3rd dimension. 
> > 
> > param = T.concatenate( 
> >     [img_param[:, :, :, :3], cost.repeat(2, axis=3)], 
> >     axis=3 
> > ) 
> > 
> > 
> > img_param has the shape (1, 128, 128, 5), cost is of shape (1, 128, 128, 
> 1). 
> > 
> > If I take cost directly from the input, this works perfectly fine. 
> > Yet, if I first run T.nnet.conv2d with a constant filter (1, 1, 1, 1) I 
> get: 
> > 
> > ValueError: all the input array dimensions except for the concatenation 
> > axis must match exactly 
> > Apply node that caused the error: Join(TensorConstant{3}, Subtensor{::, 
> ::, 
> > ::, :int64:}.0, Reshape{4}.0) 
> > Toposort index: 12 
> > Inputs types: [TensorType(int8, scalar), TensorType(float32, 4D), 
> > TensorType(float32, 4D)] 
> > Inputs shapes: [(), (1, 128, 128, 3), (1, 128, 1, 2)] 
> > 
> > The conv2d call: 
> > 
> > cost = T.nnet.conv2d( 
> >     input=input, 
> >     filters=self.unary_w, 
> >     input_shape=self.input_shp, 
> >     filter_shape=self.unary_filter_shp, 
> >     border_mode='valid' 
> > ). dimshuffle(0,2,3,1) 
> > 
> > 
> > (I also made sure all dimensions are shuffled to the correct shape) 
> > 
> > I tried returning both tensors to validate their shape and both return 
> just 
> > fine. 
> > I've looked a bit into this and it seems to have something to do with a 
> > sort of sparse-matrix conversion. Meaning Theano just automatically 
> drops 
> > dimensions which are close to 0. 
> > 
> > Any ideas? 
> > 
> > Thanks, 
> > 
> > -- 
> > 
> > --- 
> > 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 <javascript:>. 
> > 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to