Extract activations from inermediate RESNET layers

I am new to PyTorch and I am currently working on an image classification project, in which I need to use ResNeXt-50 provided by FB .
Firstly I had some problems loading the GPU-trained model on my CPU-only machine, but I used the built-in PyTorch ResNet-50 implementation and it works fine.

However, I need to extract channel activations from 8,18,31 and 43 layer for further processing.
I have read many topics on StackOverflow and here, read the documentation, but I did not find any similar problem how to extract intermediate values from a pre-trained model.
Of course there are some, but usually they pertain ‘simpler’ nets. For example: 1, 2.

I tried using sugesstions from many posts, but all to no avail.
Could you give me some tips how to approach it?
Thanks in advance.

I am using PyTorch 0.4.1.post2

You could use forward hooks to get the desired activation.
Here is a small example for a dummy network.