|
36 | 36 | hidden_size = 512 |
37 | 37 | projection_size = 300 |
38 | 38 | embedding_size = 300 |
39 | | -num_layers = 3 |
| 39 | +num_layers = 1 |
40 | 40 |
|
41 | 41 | # ouput_size for softmax layer |
42 | 42 | output_size = projection_size |
43 | 43 |
|
| 44 | +keep_prob = 0.95 |
44 | 45 | beam_size = 10 |
45 | 46 | top_k = 10 |
46 | 47 | max_sequence_len = 20 |
|
61 | 62 | dec_inputs = tf.placeholder(tf.int32, shape=(None, batch_size), name="dec_inputs") |
62 | 63 |
|
63 | 64 | #input embedding layers |
64 | | -emb_weights = tf.Variable(tf.truncated_normal([vocab_size, embedding_size], stddev=truncated_std), name="emb_weights") |
| 65 | +emb_weights = tf.Variable(tf.truncated_normal([vocab_size, embedding_size]), name="emb_weights") |
65 | 66 | enc_inputs_emb = tf.nn.embedding_lookup(emb_weights, enc_inputs, name="enc_inputs_emb") |
66 | 67 | dec_inputs_emb = tf.nn.embedding_lookup(emb_weights, dec_inputs, name="dec_inputs_emb") |
67 | 68 |
|
|
113 | 114 | scope="decoder") |
114 | 115 |
|
115 | 116 | #output layers |
116 | | -project_w = tf.Variable(tf.truncated_normal(shape=[output_size, embedding_size], stddev=truncated_std), name="project_w") |
| 117 | +project_w = tf.Variable(tf.truncated_normal(shape=[output_size, embedding_size]), name="project_w") |
117 | 118 | project_b = tf.Variable(tf.constant(shape=[embedding_size], value = 0.1), name="project_b") |
118 | | -softmax_w = tf.Variable(tf.truncated_normal(shape=[embedding_size, vocab_size], stddev=truncated_std), name="softmax_w") |
| 119 | +softmax_w = tf.Variable(tf.truncated_normal(shape=[embedding_size, vocab_size]), name="softmax_w") |
119 | 120 | softmax_b = tf.Variable(tf.constant(shape=[vocab_size], value = 0.1), name="softmax_b") |
120 | 121 |
|
121 | 122 | dec_outputs = tf.reshape(dec_outputs, [-1, output_size], name="dec_ouputs") |
@@ -199,8 +200,6 @@ def predict(enc_inp): |
199 | 200 | if len(candidates) == 0: |
200 | 201 | break |
201 | 202 |
|
202 | | - if signal: |
203 | | - best_sequence = [signal] + best_sequence |
204 | 203 |
|
205 | 204 | return best_sequence[:-1] |
206 | 205 |
|
|
0 commit comments