Get output of intermediate layer of pre-trained model

I am interested in accessing intermediate layer outputs of the pre-trained models, ex, mobilenetV2. It’s not clear to me how to do this. I read something about hooks but from reading it seemed that wasn’t the correct way to do it.



Forward hooks are the right approach as described here.