It won’t work for a model defined like so:
class MyModel(nn.Module):
    def forward(self, x):
        ...
        x = F.relu(x)
        ...

However, it would work for a model like this:
class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        ...
        self.relu = nn.ReLU()
        ...
    def forward(self, x):
        ...
        x = self.relu(x)
        ...