How can I run separately the Encoder and Decoder layers?

For the models that are built from distinct encoding and decoding phases, is there a simple way to use them separately (without changing the actual model code)?

use cases may include:

  • text from data (use the decoder on top of a linear layer)
  • style transfer (encode, “change style”, decode)