This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import theano | |
import theano.tensor as T | |
from theano.compile import function | |
from theano.tensor.nlinalg import matrix_inverse | |
from theano.tensor.slinalg import solve | |
from theano.tensor.nlinalg import det | |
from theano.tensor.slinalg import cholesky | |
from theano.ifelse import ifelse | |
from theano.gradient import verify_grad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juancamilog@juancamilog:~/workspace/antoinette$ gdb python jacobian_segfault.py | |
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 | |
Copyright (C) 2014 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-linux-gnu". | |
Type "show configuration" for configuration details. | |
For bug reporting instructions, please see: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import theano | |
import theano.tensor as T | |
from theano import function as F, shared as S | |
from theano.sandbox.linalg import psd | |
from theano.tensor.nlinalg import matrix_inverse,det | |
from time import time | |
if __name__=='__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import theano.tensor as T | |
from theano.sandbox.linalg import psd,matrix_inverse,det,cholesky | |
import numpy as np | |
from time import time | |
def SEard(loghyp,X): | |
''' Squared exponential kernel with diagonal scaling matrix (one lengthscale per dimension)''' | |
N,idims = X.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import theano.tensor as T | |
from theano.sandbox.linalg import psd,matrix_inverse,det,cholesky | |
import numpy as np | |
from time import time | |
def SEard(loghyp,X): | |
''' Squared exponential kernel with diagonal scaling matrix (one lengthscale per dimension)''' | |
N,idims = X.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import theano.tensor as T | |
from theano.sandbox.linalg import psd,matrix_inverse,det,cholesky | |
import numpy as np | |
from time import time | |
def SEard(loghyp,X): | |
''' Squared exponential kernel with diagonal scaling matrix (one lengthscale per dimension)''' | |
N,idims = X.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import theano.tensor as T | |
from theano.sandbox.linalg import psd,matrix_inverse,det,cholesky | |
from theano.tensor.slinalg import solve_lower_triangular | |
import numpy as np | |
from time import time | |
def SEard(loghyp,X): | |
''' Squared exponential kernel with diagonal scaling matrix (one lengthscale per dimension)''' | |
N,idims = X.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register_stabilize | |
@local_optimizer([Dot, Dot22]) | |
def inv_as_solve(node): | |
if not imported_scipy: | |
return False | |
if isinstance(node.op, (Dot, Dot22)): | |
l, r = node.inputs | |
if l.owner and l.owner.op == matrix_inverse: | |
if CHECK l.owner.inputs[0] is PSD HERE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
import numpy as np | |
# inti vars | |
s = theano.tensor.matrix('s') | |
y = theano.tensor.vector('y') | |
r = theano.tensor.slinalg.Solve()(s, y) | |
# jacobian using scan | |
dr1 = theano.tensor.jacobian(r.flatten(), s) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer