Skip to content

Instantly share code, notes, and snippets.

@thearn
Created November 5, 2015 00:37
Show Gist options
  • Save thearn/faba933208316d71cdb9 to your computer and use it in GitHub Desktop.
Save thearn/faba933208316d71cdb9 to your computer and use it in GitHub Desktop.
import autograd.numpy as np
from autograd import grad
def f(A):
B = np.zeros((4,4))
B[:2, :2] = A
return B.sum()
A = np.random.randn(2,2)
df = grad(f)
print df(A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment