Python tensorflow.python.ops.rnn_cell.DropoutWrapper() Examples
The following are 3
code examples of tensorflow.python.ops.rnn_cell.DropoutWrapper().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.ops.rnn_cell
, or try the search function
.
Example #1
Source File: modules.py From cs224n-win18-squad with Apache License 2.0 | 5 votes |
def __init__(self, hidden_size, keep_prob): """ Inputs: hidden_size: int. Hidden size of the RNN keep_prob: Tensor containing a single scalar that is the keep probability (for dropout) """ self.hidden_size = hidden_size self.keep_prob = keep_prob self.rnn_cell_fw = rnn_cell.GRUCell(self.hidden_size) self.rnn_cell_fw = DropoutWrapper(self.rnn_cell_fw, input_keep_prob=self.keep_prob) self.rnn_cell_bw = rnn_cell.GRUCell(self.hidden_size) self.rnn_cell_bw = DropoutWrapper(self.rnn_cell_bw, input_keep_prob=self.keep_prob)
Example #2
Source File: seq2seq_model.py From AmusingPythonCodes with MIT License | 5 votes |
def _create_rnn_cell(self): cell = GRUCell(self.cfg.num_units) if self.cfg.cell_type == "gru" else LSTMCell(self.cfg.num_units) if self.cfg.use_dropout: cell = DropoutWrapper(cell, output_keep_prob=self.keep_prob) if self.cfg.use_residual: cell = ResidualWrapper(cell) return cell
Example #3
Source File: multi_attention_model.py From neural_sequence_labeling with MIT License | 5 votes |
def _create_single_rnn_cell(self, num_units): cell = GRUCell(num_units) if self.cfg["cell_type"] == "gru" else LSTMCell(num_units) if self.cfg["use_dropout"]: cell = DropoutWrapper(cell, output_keep_prob=self.rnn_keep_prob) if self.cfg["use_residual"]: cell = ResidualWrapper(cell) return cell