Created
November 12, 2018 04:18
-
-
Save ahmadyan/6156f540f16de948ae307bcebddadaa4 to your computer and use it in GitHub Desktop.
Auto-differentiation of Rosenbrock function using AutoGrad
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
# Build a function that also returns gradients using autograd. | |
rosenbrock_with_grad = autograd.value_and_grad(rosenbrock) | |
# Optimize using conjugate gradients from scipy | |
result = scipy.optimize.minimize(rosenbrock_with_grad, x0=np.array([0.0, 0.0]), jac=True, method='CG') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment