drqn.py 文件源码

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

项目:2048-RL-DRQN 作者: Mostafa-Samir 项目源码 文件源码
def _reduce_max(self, input_tensor, reduction_indices, c):
        """
        a constrainable version of tf.reduce_max

        Parameters:
        -----------
        input_tensor: Tensor
        reduction_indices: Tensor
        c: Tensor
            The constraints tensor
            A tensor of 0s and 1s where 1s represent the elements the reduction
            should be made on, and 0s represent discarded elements
        """
        with self.session.graph.as_default():
            min_values = tf.reduce_min(input_tensor, reduction_indices, keep_dims=True)
            not_c = tf.abs(c - 1)

            return tf.reduce_max(input_tensor * c + not_c * min_values, reduction_indices)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号