That's intriguing, I'd be curious to see a profile. Maybe for large
images it is actually worse.

One thing that might help would be to make `u` a shared variable and to
update it in `lap_and_err`, you may save a memory copy, but that may not
be a big deal.

On Mon, Oct 17, 2016, Bogdan Opanchuk wrote:
> Hi Pascal,
> 
> Thanks for the suggestion. Paradoxically though, I get 4 times worse 
> performance with nnet.conv2d: 21.3s vs 5.7s with the old nnet.conv.conv2d. 
> The new function constructor that I have:
> 
> from theano.tensor.nnet import conv2d
> 
> ...
> 
> def prepare_function_conv(dxd, dyd):
> 
>     flt = theano.shared(numpy.array([[[[0, dxd, 0], [dyd, 0, dyd], [0, dxd, 
> 0]]]]))
>     u = T.dmatrix('u')
> 
>     nx = u.shape[0]
>     ny = u.shape[1]
> 
>     conv_res = conv2d(u.reshape((1, 1, nx, ny)), flt, border_mode='valid')
>     conv_res = conv_res.reshape((nx - 2, ny - 2))
> 
>     u_new = T.set_subtensor(u[1:-1,1:-1], conv_res)
> 
>     v = u_new - u
>     err = ((v**2).sum())**0.5 / u.size
> 
>     lap_and_err = theano.function([u], [u_new, err])
>     return lap_and_err
> 
> 
> 
> -- 
> 
> --- 
> 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.


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