Solved by tom in post #4 
              
              
                A 1d example won’t do.  
But here is a simple 2d one. 
Take f(x, y) = x * exp(y). We can plot this in 3d or as a countour plot: 
f = lambda x, y: x * y.exp()
xx = torch.linspace(-1,1)[None].expand(100,100)
yy = torch.linspace(-1,1)[:, None].expand(100,100)
zz = f(xx, yy)
x0 = torch.tensor([-0.5, 0.5…