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
rnn_cell_additions.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录