Describe the bug
Computing bounds of the Heaviside function using IBP fails.
To Reproduce
>>> import torch
>>> from torch import nn
>>> from auto_LiRPA import BoundedModule, BoundedTensor, PerturbationLpNorm
>>> class TestModule(nn.Module):
... def forward(self, x):
... return torch.heaviside(x, torch.ones(1))
...
>>> module = BoundedModule(TestModule(), torch.empty(1, 5))
>>> ptb = PerturbationLpNorm(x_L=-torch.ones(10, 5), x_U=torch.ones(10, 5))
>>> x = BoundedTensor(torch.zeros(10, 5), ptb)
>>> module.compute_bounds(x=(x,), method="ibp")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/david/.miniconda3/envs/auto_LiRPA/lib/python3.10/site-packages/auto_LiRPA-0.4.0-py3.10.egg/auto_LiRPA/bound_general.py", line 1206, in compute_bounds
return self._compute_bounds_main(C=C,
File "/home/david/.miniconda3/envs/auto_LiRPA/lib/python3.10/site-packages/auto_LiRPA-0.4.0-py3.10.egg/auto_LiRPA/bound_general.py", line 1271, in _compute_bounds_main
self.ibp_lower, self.ibp_upper = self.IBP_general(node=final, C=C)
File "/home/david/.miniconda3/envs/auto_LiRPA/lib/python3.10/site-packages/auto_LiRPA-0.4.0-py3.10.egg/auto_LiRPA/interval_bound.py", line 50, in IBP_general
node.interval = node.interval_propagate(*inp)
File "/home/david/.miniconda3/envs/auto_LiRPA/lib/python3.10/site-packages/auto_LiRPA-0.4.0-py3.10.egg/auto_LiRPA/operators/activation_base.py", line 144, in interval_propagate
return self.forward(h_L), self.forward(h_U)
File "/home/david/.miniconda3/envs/auto_LiRPA/lib/python3.10/site-packages/auto_LiRPA-0.4.0-py3.10.egg/auto_LiRPA/operators/activations.py", line 73, in forward
return torch.heaviside(x[0], x[1])
IndexError: tuple index out of range
System configuration:
OS: Ubuntu 22.04.3 LTS
Python version: Python 3.10
Pytorch Version: PyTorch 1.12.1
Hardware: CPU only
Have you tried to reproduce the problem in a cleanly created conda/virtualenv environment using official installation instructions and the latest code on the main branch?: Yes
Describe the bug Computing bounds of the Heaviside function using IBP fails.
To Reproduce
System configuration: