How to get image featrue using my pre-trained model?

Hello everyone.

On the third day of studying Pytorch, I created the CNN-VAE pre-trained model.

I save the model using torch.save method in ./model/{epoch}

My VAE model class defines functions such as forward, bottleneck, and reparameterize.

So in my opinion, it seems to work after creating another script and loading this model into it.

After loading the model and executing the bottleneck after encoding, the feature will be created.

Also, since data is a lip-leading image, I would like the feature to be stored in order of name.

Is there anything I can refer to in this situation?

Thanks,

Which feature/layer would you like to get?
You could use forward hooks as shown in this example or modify your forward function to return a specific activation.