From bdeaf84d2defc5a2408b84cebf6e499a7f3339e0 Mon Sep 17 00:00:00 2001 From: hx507 <72583014+hx507@users.noreply.github.com> Date: Mon, 18 Oct 2021 06:27:50 +0800 Subject: [PATCH] Fix IBP support for BoundSlice While slice is monotone, it have multiple parameters and can not use the default IBP method implemented in the base class --- auto_LiRPA/bound_ops.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/auto_LiRPA/bound_ops.py b/auto_LiRPA/bound_ops.py index b556e97..d8463aa 100644 --- a/auto_LiRPA/bound_ops.py +++ b/auto_LiRPA/bound_ops.py @@ -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 @@ -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: