You will need to modify the method grad (see http://deeplearning.net/software/theano/extending/extending_theano.html#extending-theano )
of the class DiffOp in the file theano/tensor/extra_ops.py It is currently working when ndim==1 for the input. Mostly, you need to modify it to implement it when ndim==2. Try not to use scan, it would slow things down. Fred On Mon, Jul 25, 2016 at 4:31 PM, Aditya Gudimella < [email protected]> wrote: > I would love to implement my case, but I don’t exactly know which > functions to add. I can think of a way in which diff can be converted to a > scan op but I don’t know if that’ll help with grad or just slow down things. > > On Jul 21, 2016, at 2:09 PM, Frédéric Bastien <[email protected]> > wrote: > > We haven't implemetned the grad for the diff op if the input isn't a > vector. > > Do you want to implement your cases? > > Fred > > On Thu, Jul 21, 2016 at 11:54 AM, Aditya Gudimella < > [email protected]> wrote: > >> a = shared(np.arange(3*8).reshape(8,3).astype('float32')) >> b = diff(a, axis=0) >> T.grad(b.norm(2), a) >> >> >> This gives me an error. It's unable to find the gradient of the diff >> operator if it has been used on a 2 dimensional tensor. Is this how it was >> meant to be or is this a bug? >> >> -- >> >> --- >> 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. >> > > > -- > > --- > 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/r4tLV0BTvGU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > 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. > -- --- 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.
