7f6cd7f219c8c7f77b8e49e92f26ffae9229d698,src/math_util.py,,logsumexp,#Any#,53
Before Change
def logsumexp(array):
m = max(array)
if m == float("inf"):
return float("inf")
elif m == -float("inf"):
return -float("inf")
// This math.exp can"t overflow b/c a - m is <= 0, so ieee_exp is
// the same.
return m + math.log(sum(math.exp(a - m) for a in array))
def logmeanexp(array):
return logsumexp(array) - math.log(len(array))
After Change
// -inf. But if +inf and -inf are among the inputs, or if input is
// NaN, let the usual computation yield a NaN.
if math.isinf(m) and min(array) != -m and \
all(not math.isnan(a) for a in array):
return m
// Since m = max{a_0, a_1, ...}, it follows that a <= m for all a,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: probcomp/bayeslite
Commit Name: 7f6cd7f219c8c7f77b8e49e92f26ffae9229d698
Time: 2016-03-16
Author: riastradh+probcomp@csail.mit.edu
File Name: src/math_util.py
Class Name:
Method Name: logsumexp
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 6a4956e37e6c42c691f7937cf01b47381bd24c83
Time: 2021-03-11
Author: beat.buesser@ie.ibm.com
File Name: art/attacks/evasion/projected_gradient_descent/projected_gradient_descent_pytorch.py
Class Name: ProjectedGradientDescentPyTorch
Method Name: _apply_perturbation
Project Name: pfnet/optuna
Commit Name: 9a8973bc7b87ecff93c89bb58638c9940cd5ceb3
Time: 2018-08-03
Author: toshihiko.yanase@gmail.com
File Name: pfnopt/integration/chainer.py
Class Name: ChainerPruningExtension
Method Name: __call__