Nikronic:

There is no issue with using derivatives in loss term. For instance, you can solve Poisson PDE using its equation as loss function (and applying boundary/initial condition).


Note that the loss term here seems to have the wrong sign between the terms if the frequency matches…