Solved by ptrblck in post #4 
              
              
                Here is a small dummy example to use the some intermediate activation in your loss: 
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.fc1 = nn.Linear(10, 64)
        self.fc2 = nn.Linear(64, 10)

    def forward(self, x):
        x1 = F.relu(self…