I don’t have an example implementation from the top of my mind.
If you have a specific algorithm in mind you might be able to find an implementation online though.
Whatever algorithm you want to use to solve your unconstrained problem, you can use pytorch to get gradients and/or perform the steps you need.

But there are many conditions for the lagrange multiplier, so I don’t know how to implement it.

Lagrage Multipliers is just one way to rewrite the problem. You still need to select an optimization algorithm to solve this new problem.