Skip to content

Commit

Permalink
Merge pull request #13 from hx507/master
Browse files Browse the repository at this point in the history
Fix IBP support for BoundSlice
  • Loading branch information
shizhouxing authored Oct 18, 2021
2 parents 319252b + bdeaf84 commit 2c68627
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 2c68627

Please sign in to comment.