upper bound and lower bound are always equal
See original GitHub issueHi,
Recently I am using your auto_LiRPA to compute the perturbation bound of hidden features. However, I found that the ub and lb are always exactly the same.
eps = 0.012
actions = actions.cuda()
states = states.to(torch.float)/255.0
actions = actions.to(torch.float)
eps_v = eps
state_max = 1.0
state_min = 0.0
state_ub = torch.clamp(states + eps_v, max=state_max)
state_lb = torch.clamp(states - eps_v, min=state_min)
ptb = PerturbationLpNorm(norm = np.inf, eps=eps, x_L=state_lb, x_U=state_ub)
bnd_states = BoundedTensor(states, ptb)
bnd_states = bnd_states.cuda()
#####################################
features = featurenet(bnd_states)
q_values = qnet(features) # input x and predict based on x
labels = torch.argmax(actions, dim=1)
loss = loss_func(q_values, labels)
####################################
lb, ub = featurenet.compute_bounds(IBP=False)
print(torch.mean(lb).item(), torch.mean(ub).item(), torch.max(lb).item(), torch.max(ub).item())
The print results show that the ub and lb are always same.
0.450094610452652 0.450094610452652 2.707549571990967 2.707549571990967
0.48474934697151184 0.48474934697151184 2.94636869430542 2.94636869430542
0.46419665217399597 0.46419665217399597 2.889254093170166 2.889254093170166
0.481861412525177 0.481861412525177 3.1563448905944824 3.1563448905944824
0.48333269357681274 0.48333269357681274 3.0463905334472656 3.0463905334472656
0.4830339848995209 0.4830339848995209 3.1504933834075928 3.1504933834075928
0.49715957045555115 0.49715957045555115 3.2522659301757812 3.2522659301757812
0.478254109621048 0.478254109621048 3.142927408218384 3.142927408218384
0.5154712200164795 0.5154712200164795 3.2538249492645264 3.2538249492645264
0.49771052598953247 0.49771052598953247 3.1791763305664062 3.1791763305664062
0.4898771643638611 0.4898771643638611 3.212333917617798 3.212333917617798
0.5144965648651123 0.5144965648651123 3.347181558609009 3.347181558609009
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Upper and lower bounds - Wikipedia
In mathematics, particularly in order theory, an upper bound or majorant of a subset S of some preordered set (K, ≤) is an...
Read more >Upper and Lower Bounds of a Finite Set - Expii
If every number in the set is less than or equal to the bound, the bound is an upper bound. If every number...
Read more >Lower and Upper Bound Theory - GeeksforGeeks
Note that our main motive is to get an optimal algorithm, which is the one having its Upper Bound the Same as its...
Read more >Difference between supremum and upper bounds and ...
A supremum is always an upper bound, but not every upper bound is a supremum: the supremum is the smallest upper bound. Likewise,...
Read more >Upper & Lower Bounds | Number | Maths | FuseSchool
Upper & Lower Bounds | Number | Maths | FuseSchoolIn this video we discover what bounds. All measurements are approximate.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@huanzhang12 @shizhouxing Thanks. Hope you guys are safe and healthy during this tough time in the US. Happy lunar new year ahead.
@QuXinghuaNTU You should switch the two lines:
The correct way is to do this:
After calling
.cuda()
, the BoundedTensor becomes a normaltorch.Tensor
and the bound property gets lost. @shizhouxing maybe you can take a look on how to avoid this.BTW @QuXinghuaNTU we have a project on using auto_LiRPA with Atari DQN, which might be helpful for you: https://github.com/chenhongge/SA_DQN You can find most relevant code here and here