利用pytorch中的钩子(hook),我们不用改变输入输出中间的网络结构,可以方便的获取、改变网络中间层变量的值和梯度。本篇文章记录了如何利用register_forward_hook(hook)获取pre-trained模型任意层的输出特征图并保存。 register_forward_hook(hook)说明 Registers a forward hook on the module. The hook will be called every time after forward() has computed an output. It should have the fol...