Get the latest tech news

Intermediate Activations – the forward hook (2020)


Table of contents

As a researcher actively developing deep learning models, I have come to prefer PyTorch for its ease of usage, stemming primarily from its similarity to Python, especially Numpy. A basic method discussed in PyTorch forums is to reconstruct a new classifier from the original one with the architecture you desire. To give a concrete example for ResNet, let’s say we want the concatenated outputs of model.maxpool, our old friend model.layer3[0].downsample[1], the model.avgpool and the popular layer that feeds into the softmax (i.e., model.fc) for every forward pass of an image.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of forward hook

forward hook