Last active
January 14, 2018 23:59
-
-
Save vinhkhuc/fb9cd4d551045b726689 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
from theano import tensor as T, function | |
x = T.dscalar('x') | |
y = x ** 2 | |
dy = T.grad(cost=y, wrt=x) # Preparing symbolic gradient | |
df = function(inputs=[x], outputs=dy) | |
print(df(4)) # Output: 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment