`NeuralPDE.jl`: How to impose Dirichlet boundary conditions as hard constraints?

You can just do thisby putting a last layer. For example, if you want Dirchlet s.t. u(0)=u(1)=0, you just put a layer defined as f(x) = x*(x-1)*NN(x) and the property is guaranteed by design.