How to implement a custom regularisation for a given LinearLayer?

This question looks very similar to one I posted a few weeks ago. Directly emulate Ridge Regression and LASSO with a neural network? I have made some progress on it but have not had time to post a notebook of results. My approach looks similar to yours with shared arrays. If you want to message me, I can send you a no warranties notebook.