Do we have a get_layers() method?

My main concern in such scenarios is whether modifying the list of layers
would invalidate other state in the MLP object. If it would, it should be
private.

A way to preserve existing client code would be to add this:

```python
@property
def layers(self):
    return tuple(self._layers)
```



On Sun, May 5, 2013 at 11:17 AM, Ian Goodfellow <notifications@github.com>wrote:

> In pylearn2/base.py:
>
> > @@ -169,7 +181,16 @@ def append(self, layer):
> >          """
> >          Add a new layer on top of the last one
> >          """
>
> 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.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/lisa-lab/pylearn2/pull/265/files#r4086897>
> .
>