Created
November 14, 2014 16:41
-
-
Save rizar/ea6aa6e750e1a9548703 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import theano | |
from theano import tensor | |
from theano.printing import debugprint | |
floatX = theano.config.floatX | |
foo_a, foo_x, r = 3 * [None] | |
def foo(x, a): | |
global foo_a, foo_x, r | |
foo_a = a | |
foo_x = x | |
r = a + x | |
return r | |
x = tensor.vector('x') | |
s, _ = theano.scan(foo, sequences=x, | |
outputs_info=[numpy.array(0, dtype=floatX)]) | |
r2 = foo_x - foo_a | |
# Prints two similar scan inner graphs | |
debugprint(s) | |
debugprint(theano.clone(s, replace=[(r, r2)])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment