Give layers a pointer to their owning Net

This allows layers to do essentially arbitrary things that depend on the structure of the net.

This provides a lot of power, but breaks the nice abstraction of a layer as a function-with-gradient. A future PR will depend on this functionality. If it seems sufficiently useful, perhaps we should merge this, but be wary not to abuse it. Or perhaps we should find another way to compute on the structure of nets. Or perhaps we should do the former keeping the latter as a future possibility.