It’s expected, as ResNet uses a functional call to torch.flatten in the forward pass in this line of code 31.
You could either derive a custom ResNet class and reimplement the forward method or use forward hooks to get the desired activation.
Alternatively, you could also create an nn.Sequential container and add the layers in the same order as they are called in the original forward method.