beam_search.py 文件源码

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

项目:tefla 作者: openAGI 项目源码 文件源码
def create_initial_beam_state(config):
    """Creates an instance of `BeamState` that can be used on the first
    call to `beam_step`.

    Args:
      config: A BeamSearchConfig

    Returns:
      An instance of `BeamState`.
    """
    return BeamSearchState(
        log_probs=tf.zeros([config.beam_width]),
        finished=tf.zeros(
            [config.beam_width], dtype=tf.bool),
        lengths=tf.zeros(
            [config.beam_width], dtype=tf.int32))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号