How can I get the mid-level output of a trained model?

Hi I’m a newbie in DL and pytorch and I have some questions.

I want to deploy a DL model in an Android app. (suppose it’s an app about image classification…)

Typically,
we can take a picture to get our input and transform it to tensor type (noted as mInputTensor),
we can use Module.load() method to load our script model (noted as mModule ),
we can use mModule.forward(IValue.from(mInputTensor)).toTensor() method to get our output (noted as mOutputTensor).

However,I just want to get some specfic layer’s output rather than the final output mOutputTensor. (E.g convolution layer’s outout feature map)
So if there a method that I can get such mid-level outputs or if there is a way I can terminate the forward() method before or after a specific layer?