4ce9a9d078d41af1a960f0e5bf16e373f69d5117,open_seq2seq/encoders/rnn_encoders.py,GNMTLikeEncoderWithEmbedding,_encode,#GNMTLikeEncoderWithEmbedding#Any#,344
Before Change
if self.params["encoder_layers"] < 2:
raise ValueError("GNMT encoder must have at least 2 layers")
cell_params = copy.deepcopy(self.params)
cell_params["num_units"] = self.params["encoder_cell_units"]
with tf.variable_scope("Level1FW"):
self._encoder_l1_cell_fw = create_rnn_cell(
cell_type=self.params["encoder_cell_type"],
cell_params=cell_params,
num_layers=1,
dp_input_keep_prob=1.0,
dp_output_keep_prob=1.0,
residual_connections=False,
)
with tf.variable_scope("Level1BW"):
self._encoder_l1_cell_bw = create_rnn_cell(
cell_type=self.params["encoder_cell_type"],
cell_params=cell_params,
num_layers=1,
dp_input_keep_prob=1.0,
dp_output_keep_prob=1.0,
residual_connections=False,
)
if self._mode == "train":
dp_input_keep_prob = self.params["encoder_dp_input_keep_prob"]
dp_output_keep_prob = self.params["encoder_dp_output_keep_prob"]
After Change
dp_output_keep_prob = 1.0
with tf.variable_scope("UniDirLevel"):
self._encoder_cells = [single_cell(
cell_class=self.params["core_cell"],
cell_params=self.params.get("core_cell_params", {}),
dp_input_keep_prob=dp_input_keep_prob,
dp_output_keep_prob=dp_output_keep_prob,
residual_connections=False) for _ in range(self.params["encoder_layers"] - 1)]
// add residual connections starting from the third layer
for idx, cell in enumerate(self._encoder_cells):
if idx > 0:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 4ce9a9d078d41af1a960f0e5bf16e373f69d5117
Time: 2018-06-13
Author: okuchaiev@nvidia.com
File Name: open_seq2seq/encoders/rnn_encoders.py
Class Name: GNMTLikeEncoderWithEmbedding
Method Name: _encode
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 4ce9a9d078d41af1a960f0e5bf16e373f69d5117
Time: 2018-06-13
Author: okuchaiev@nvidia.com
File Name: open_seq2seq/encoders/rnn_encoders.py
Class Name: GNMTLikeEncoderWithEmbedding
Method Name: _encode
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 4ce9a9d078d41af1a960f0e5bf16e373f69d5117
Time: 2018-06-13
Author: okuchaiev@nvidia.com
File Name: open_seq2seq/decoders/rnn_decoders.py
Class Name: BeamSearchRNNDecoderWithAttention
Method Name: _decode
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 4ce9a9d078d41af1a960f0e5bf16e373f69d5117
Time: 2018-06-13
Author: okuchaiev@nvidia.com
File Name: open_seq2seq/decoders/rnn_decoders.py
Class Name: RNNDecoderWithAttention
Method Name: _decode