The proper way would be to check the forward method of your model, as it would define which layer is used last.
Since you could use arbitrary conditions inside the forward, you would have to check the actual logic.
In case you are using an nn.Sequential module, you could directly use the last layer.