Add a version of layerwise training for networks with tied weights.