unit test for layers with shared parameters.