Skip to content

Commit

Permalink
add relu to pointwise-lstm
Browse files Browse the repository at this point in the history
  • Loading branch information
‘zhanghan1992’ committed Nov 1, 2018
1 parent 85d5197 commit 60b698a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/simnet/train/tf/nets/lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, config):
self.extract = layers.ExtractLastLayer()
if self.task_mode == "pointwise":
self.n_class = int(config['n_class'])
self.relu_layer = layers.ReluLayer()
self.fc1_layer = layers.FCLayer(self.rnn_hidden_size * 2, self.hidden_size)
self.fc2_layer = layers.FCLayer(self.hidden_size, self.n_class)
elif self.task_mode == "pairwise":
Expand All @@ -66,7 +67,8 @@ def predict(self, left_slots, right_slots):
if self.task_mode == "pointwise":
rep_concat = tf.concat([left_rep, right_rep], -1)
hidden1 = self.fc1_layer.ops(rep_concat)
pred = self.fc2_layer.ops(hidden1)
hidden1_relu = self.relu_layer.ops(hidden1)
pred = self.fc2_layer.ops(hidden1_relu)
elif self.task_mode == "pairwise":
left_hidden1 = self.fc1_layer.ops(left_rep)
right_hidden1 = self.fc1_layer.ops(right_rep)
Expand Down

0 comments on commit 60b698a

Please sign in to comment.