How to save features of a layer and reuse them later?

If you would like to store the activations, you could use forward hook as described in this example. Instead of the print statements use torch.save to save the activations using the dict.

Later, you can restore these activations using torch.load and use them as your training samples for the second model.