rnn_cell_additions.py 文件源码

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

项目:gradual-learning-rnn 作者: zivaharoni 项目源码 文件源码
def __call__(self, inputs, state, scope=None):
        """Run the cell with the declared dropouts."""
        output, state = self._cell(inputs, state, scope)
        (c, h) = state
        with tf.name_scope("Dropout"):
            if (isinstance(self._output_keep_prob, float) and
                        self._output_keep_prob == 1):
                return
            new_h_out = math_ops.div(h, self._output_keep_prob) * self._output_mask
            new_h_fb = math_ops.div(h, self._state_keep_prob) * self._state_mask
            new_state = core_rnn_cell.LSTMStateTuple(c, new_h_fb)

        return new_h_out, new_state
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号