cts.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tensorflow-rl 作者: steveKapturowski 项目源码 文件源码
def log_add(log_x, log_y):
    """Given log x and log y, returns log(x + y)."""
    # Swap variables so log_y is larger.
    if log_x > log_y:
        log_x, log_y = log_y, log_x

    # Use the log(1 + e^p) trick to compute this efficiently
    # If the difference is large enough, this is effectively log y.
    delta = log_y - log_x
    return math.log1p(math.exp(delta)) + log_x if delta <= 50.0 else log_y
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号