out contains a list of layers it passed through the feed-forward process, every time you do out = layer(out), the layer is added to the list. Once you back-propagate it goes through the list from the last to the first on the list.