Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IBP support for BoundSlice #13

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion auto_LiRPA/bound_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -4266,7 +4266,7 @@ def __init__(self, input_name, name, ori_name, attr, inputs, output_index, optio
self.start = attr["starts"][0] if "starts" in attr else None
self.end = attr["ends"][0] if "ends" in attr else None
self.axes = attr["axes"][0] if "axes" in attr else None
self.use_default_ibp = True
self.use_default_ibp = False

# Older Pytorch version only passes steps as input.
@Bound.save_io_shape
Expand All @@ -4290,6 +4290,11 @@ def forward(self, x, start=None, end=None, axes=None, steps=1):
if steps == -1:
final = torch.flip(final, dims=tuple(axes))
return final

def interval_propagate(self, *v):
lb = tuple(map(lambda x:x[0],v))
ub = tuple(map(lambda x:x[1],v))
return Interval.make_interval(self.forward(*lb), self.forward(*ub))

def infer_batch_dim(self, batch_size, *x):
if x[0] == -1:
Expand Down