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 torch | |
| import torch.optim as optim | |
| import matplotlib.pyplot as plt | |
| # 2d Rosenbrock function | |
| def f(x): | |
| return (1 - x[0])**2 + 100 * (x[1] - x[0]**2)**2 | |