I have saved parameters of a trained neural network(actually a variational autoencoder) using

state = {
‘epoch’: epoch,
‘state_dict’: model.state_dict(),
‘optimizer’: optimizer.state_dict()}
torch.save(state, PATH)

I would like to load the parameters and only use certain layers of my neural network(decoder of VAE) for other purposes. I am able to load the state using

state = torch.load(PATH)

But I don’t know how to access the decoder layer of my neural network without defining the full neural network in the new file.