Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
scipy 的logsumexp() 实现是否包括通过从每个元素中减去数组中找到的最大值来防止下溢的技巧?
logsumexp()
下面解释了一个,其中m = maxval:
m = maxval
logsumexp 您可以检查此处定义的源代码。(请注意,文档页面上有指向源的链接)。
logsumexp
你会看到的:
a_max = a.max(axis=0) ... out = log(sum(exp(a - a_max), axis=0))
所以是的,scipy'slogsumexp是从每个元素中减去最大值。