Created
March 13, 2016 23:34
-
-
Save Sentient07/61937a7cbd65e594e10c to your computer and use it in GitHub Desktop.
A failing example of large graph in theano due to max recursion depth error
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
#!/usr/bin/python | |
import theano.tensor as T | |
import theano | |
from cgt.utils import Message | |
import time | |
import cgt | |
if __name__ == '__main__': | |
a = T.scalar(name='a', dtype='int64') # | |
b = T.scalar(name='b', dtype='int64') | |
n = T.scalar(name='n', dtype='int64') # integer scalar | |
m = T.scalar(name='m', dtype='int64') # integer scalar | |
c = ((a + b)**(1/n+m)) + ((a-b)**(1/n-m)) | |
d = (1/a)**(a+b) | |
for i in range(100): | |
c = ((c*d) + d) / d | |
with Message("compiling"): | |
h2 = theano.clone(c, {a:((a+b)**(1/n+1) - (a+b)**(1/n+1))}) | |
f = theano.function([a,b,n,m], c) #Fails | |
with Message("running"): | |
print (f(3,4,5,6)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment