code: public void pretrain(DataSetIterator iter, int numEpochs){
          if (flattenedGradients == null) {
              initGradientsView();
          }
  
          for (int i = 0; i < getnLayers(); i++) {
              pretrainLayer(i, iter, numEpochs);
          }
      }
docs: Perform layerwise unsupervised training on all pre-trainable layers in the network (VAEs, Autoencoders, etc), for the specified
  number of epochs each. For example, if numEpochs=3, then layer 0 will be fit for 3 epochs, followed by layer 1
  for 3 epochs, and so on.<br>
  Note that pretraining will be performed on one layer after the other. To perform unsupervised training on a single layer,
  use {@link #pretrainLayer(int, DataSetIterator)}
  
  @param iter Training data