While it is possible (you’d want to assign the net to ctx._net instead of using save_for_backward, probably), it certainly is not advisable to do so.
A more natural way would be to pass the net.weight as an argument to the forward (and, if you don’t want to differentiate with respect to that, return None).