fb5b85e7f4c9af0190019ea8a8bcaa3e4a1e6d6b,torchsample/constraints.py,MaxNorm,__call__,#MaxNorm#,121
Before Change
if self.lagrangian:
w = module.weight
norm = th.norm(w,2,self.axis)
return self.scale * th.sum(th.clamp(norm-self.value,0,1e-15))
else:
w = module.weight
norm = th.norm(w,2,self.axis).expand_as(w) / float(self.value)
After Change
if self.lagrangian:
w = module.weight
norm_diff = th.norm(w,2,self.axis).sub(self.value)
return self.scale * th.sum(norm_diff.gt(0).float().mul(norm_diff))
else:
module.weight.data = th.renorm(module.weight.data, 2, self.axis, self.value)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: ncullen93/torchsample
Commit Name: fb5b85e7f4c9af0190019ea8a8bcaa3e4a1e6d6b
Time: 2017-05-01
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/constraints.py
Class Name: MaxNorm
Method Name: __call__
Project Name: ncullen93/torchsample
Commit Name: fb5b85e7f4c9af0190019ea8a8bcaa3e4a1e6d6b
Time: 2017-05-01
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/constraints.py
Class Name: UnitNorm
Method Name: __call__
Project Name: ncullen93/torchsample
Commit Name: fb5b85e7f4c9af0190019ea8a8bcaa3e4a1e6d6b
Time: 2017-05-01
Author: ncullen@Nicks-MacBook-Pro.local
File Name: torchsample/constraints.py
Class Name: NonNeg
Method Name: __call__