rfeinman / pytorch-minimize

Newton and Quasi-Newton optimization with PyTorch
https://pytorch-minimize.readthedocs.io
MIT License
292 stars 34 forks source link

Batch optimization #30

Closed yimingli1998 closed 8 months ago

yimingli1998 commented 9 months ago

Thank you for the nice library! These solvers are pretty good but in reality, they are easy to fall into local optimum. I am wondering if it is possible to have a batch version with different initial guess in Pytorch? For instance, the example in your case

# initial point
x0 = torch.tensor([1., 8.])

can be

# initial point
x0 = torch.rand(N,2)

and outputs are with N results, so that we can choose the best one.

yimingli1998 commented 8 months ago

I just found that it already supports batch operation and my previous code was wrong. Thank you again for the nice library!