Re: [theano-users] derivative of function based on eigenvalues in theano

Thanks, Fred.

On Thu, Aug 10, 2017 at 6:41 PM, Frédéric Bastien <
frederic.bast...@gmail.com> wrote:

> The problem is smat(x)
>
> It return list of list of Theano variable. This isn't a Theano variable
> itself. You can have Theano contact all of this correctly to make a new
> corresponding Theano variable with:
>
> v,w=nlin.eigh(theano.tensor.stacklists(smat(x)))
>
> Fred
>
> On Tue, Aug 1, 2017 at 7:37 AM Jyotiranjan Beuria <
> jyotiranjan.beu...@gmail.com> wrote:
>
>> Hi All,
>>
>> I am trying to calculate the derivative of a function that
>> depends on eigenvalues of a matrix. I am new to Theano.
>> Here is a snippet of the code.
>> import numpy as np
>>
>> import theano
>> import theano.tensor as T
>> import theano.tensor.nlinalg as nlin
>>
>> def myFun(X,a=2):
>>     s=T.dmatrix('s')
>>     x=T.dvector('x')
>>     a=T.dscalar('a')
>>     def smat(x):
>>       return  [[x[0]**2,x[1],x[2]],
>>                [x[1]**2,a*x[1],a*X[0]],
>>                [x[2]**2,x[0],a*x[1]]]
>>     v,w=nlin.eigh(smat(x))
>>     Eigen,Grad = theano.function([x], [v,TG],allow_input_downcast=True )
>>
>>     ev=Eigen(X)
>>     print ev,der
>>
>> myFun([2,3,5])
>>
>> Can anyone help me to solve this problem?
>>
>> Regards,
>> Jyotiranjan
>>
>> --
>>
>> ---
>> 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
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/theano-users/2FKrpaS4Q7Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> For more options, visit https://groups.google.com/d/optout.
>

--
Jyotiranjan Beuria