Equality constrained optimization

Hello,

I am interested in performing equality-constrained optimization using PyTorch. In other words, let’s say that I have p, q as inputs to the NN, where Z is the output. The examples are split into two types: 1) the mapping from p,q to Z cannot be violated. So, I need the network to return the exact target values. 2) For the rest of the examples (p, q), Z is found using the regression model to be developed, and it is okay to be a bit off from the targets.

So, I am interested in doing this equality-constrained problem; any insights/feedback is much appreciated.