def _is_relu(activation: Callable) -> bool:
    """More robust than isinstance(activation, torch.nn.ReLU), which doesn't always work."""
    if isinstance(activation, torch.nn.ReLU):
        return True
    else:
        test_input = torch.randn(10) * 10 ** torch.randn(10)
        return torch.equal(activation(test_input), torch.nn.ReLU()(test_input))
More robust than isinstance(activation, torch.nn.ReLU), which doesn't always work.
neuron_explainer/activations/derived_scalars/autoencoder.py