Skip to content

Commit

Permalink
preliminary submission without resnet
Browse files Browse the repository at this point in the history
  • Loading branch information
MekAkUActOR committed Nov 25, 2022
1 parent 76e9308 commit 5c8665d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
43 changes: 22 additions & 21 deletions code/deeppoly.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,24 +323,25 @@ def pad_image(temp_input, padding):
return temp_input


class DPBatchNorm2d(nn.Module):
def __init__(self, in_features):
super(DPBatchNorm2d, self).__init__()
self.in_features = in_features
self.out_features = in_features

def forward(self, x):
x.save()
low, up = x.lb, x.ub

x.lb = F.relu(low)
x.ub = F.relu(up)
x.slb = torch.cat([curr_slb.unsqueeze(0), curr_slb_bias.unsqueeze(0)], dim=0)
x.sub = torch.cat([curr_sub.unsqueeze(0), curr_sub_bias.unsqueeze(0)], dim=0)
x.is_relu = True
return x

@staticmethod
def batchNorm(x):
one_channel

# class DPBatchNorm2d(nn.Module):
# def __init__(self, in_features):
# super(DPBatchNorm2d, self).__init__()
# self.in_features = in_features
# self.out_features = in_features
#
# def forward(self, x):
# x.save()
# x.lb = self.batchNorm(x.lb)
# x.ub = self.batchNorm(x.ub)
# curr_slb =
# x.slb = torch.cat([curr_slb.unsqueeze(0), curr_slb_bias.unsqueeze(0)], dim=0)
# x.sub = torch.cat([curr_sub.unsqueeze(0), curr_sub_bias.unsqueeze(0)], dim=0)
# x.is_relu = True
# return x
#
# @staticmethod
# def batchNorm(x):
# mean = torch.mean(x)
# std = torch.std(x, unbiased=False)
# one_channel_batchnorm = (x - mean) / std
# return one_channel_batchnorm
2 changes: 1 addition & 1 deletion code/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def main():

inputs, true_label, eps = get_spec(args.spec, dataset)
net = get_net(args.net, net_name)
print(net)
# print(net)

outs = net(inputs)
pred_label = outs.max(dim=1)[1].item()
Expand Down

0 comments on commit 5c8665d

Please sign in to comment.