Discussion:
[theano-users] gradient for theano SVD object
Shadekur Rahman
2017-09-06 18:46:21 UTC
Permalink
Trying to use theano gradient when computation graph contains T.nlinalg.svd

import theanoimport theano.tensor as T

W = theano.shared(self.get_weights(5,5)) #numpy ndarray with size(5,5)
_,e,_ = T.nlinalg.svd(W)
cost = e[0]
res = theano.grad(cost, [W]) #gives an error


getting the following error:

AttributeError: 'SVD' object has no attribute 'grad'


Does anyone know some workaround for this problem?
--
---
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.
Juan Camilo Gamboa Higuera
2017-09-07 19:17:29 UTC
Permalink
The workaround is to implement the missing grad method. If you'd like to do
it, you can try the method described in this paper:

https://hal.inria.fr/inria-00072686/document

Link to discussion on the Theano repo:
https://github.com/Theano/Theano/issues/5440
Post by Shadekur Rahman
Trying to use theano gradient when computation graph contains T.nlinalg.svd
import theanoimport theano.tensor as T
W = theano.shared(self.get_weights(5,5)) #numpy ndarray with size(5,5)
_,e,_ = T.nlinalg.svd(W)
cost = e[0]
res = theano.grad(cost, [W]) #gives an error
AttributeError: 'SVD' object has no attribute 'grad'
Does anyone know some workaround for this problem?
--
---
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.
Loading...