Skip to content

Instantly share code, notes, and snippets.

@kastnerkyle
Created July 29, 2014 14:26
Show Gist options
  • Save kastnerkyle/29be76e78adaebaa2b69 to your computer and use it in GitHub Desktop.
Save kastnerkyle/29be76e78adaebaa2b69 to your computer and use it in GitHub Desktop.
Example of using theano.clone to replace an input
import theano.tensor as T
import theano
a = T.vector()
b = T.matrix()
fa = a ** 2
f = theano.function([a], fa)
f2 = theano.function([b], theano.clone(fa, replace={a: b}, strict=False))
print(f([2]))
print(f2([[2]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment