【模型转换tips】torch.logsumexp
作者:互联网
torch.logsumexp的计算就是字面意思
但是自己实现的话发现单exp这一步输出就会出现溢出变成inf,就是无穷大
发现函数里头的小技巧是进行了平移:
参考:
机器学习 - 计算 Log-Sum-Exp
8. log_sum_exp的trick
https://blog.csdn.net/qq_37532213/article/details/117653946?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-117653946-blog-115217082.pc_relevant_antiscanv2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-117653946-blog-115217082.pc_relevant_antiscanv2&utm_relevant_index=2
https://blog.csdn.net/liu16659/article/details/115217082
标签:relevant,117653946,torch,utm,blog,pc,logsumexp,tips,115217082 来源: https://www.cnblogs.com/leifzhang/p/16243373.html