text_corrector_models.py 文件源码

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

项目:deep-text-corrector 作者: atpaino 项目源码 文件源码
def project_and_apply_input_bias(logits, output_projection, input_bias):
    if output_projection is not None:
        logits = nn_ops.xw_plus_b(
            logits, output_projection[0], output_projection[1])

    # Apply softmax to ensure all tokens have a positive value.
    probs = tf.nn.softmax(logits)

    # Apply input bias, which is a mask of shape [batch, vocab len]
    # where each token from the input in addition to all "corrective"
    # tokens are set to 1.0.
    return tf.mul(probs, input_bias)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号