Solved by Koro in post #3 
              
              
                Wrapping the desired Layer into a custom module solves the issue here. Using _norm() from above, you can implement a module with, for example, a Linear Layer + Weight Norm this way: 
struct Linear_WN_Impl : torch::nn::Module
{
	torch::Tensor v;
	torch::Tensor g;
	torch::Tensor bias;
	torch::nn::Line…