albanD:

activations[layer] = inputs[0].detach()


Shouldn’t activations of layer be the outputs variable?
P.S. Since we are using the word activation, it should require applying relu or other activation.(Sorry, ignore this).