Are you sure "layers" needs to be private?

For MLPs and DBMs it's common for client code to iterate over all layers. For example, the WeightDecay classes iterate over each layer, ask it for the weight decay objective term for that layer, and then multiply it by the corresponding coefficient.