model.py 文件源码

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

项目:DHP 作者: YuhangSong 项目源码 文件源码
def categorical_sample(logits, d, exploration=True):
    # value = tf.squeeze(tf.multinomial(logits - tf.reduce_max(logits, [1], keep_dims=True), 1), [1])
    temp = logits - tf.reduce_max(logits, [1], keep_dims=True)
    if exploration is True:
        temp = tf.multinomial(temp, 1)
    elif exploration is False:
        temp = tf.expand_dims(tf.argmax(temp, 1),-1)
    temp = tf.squeeze(temp, [1])
    temp = tf.one_hot(temp, d)
    return temp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号