我試圖從https://arxiv.org/pdf/1609.05473.pdf運行SequenceGAN(https://github.com/LantaoYu/SeqGAN)。
固定明顯的錯誤,就像stack
更換pack
後,它仍然無法運行,因爲高速公路網絡的一部分需要tf.nn.rnn_cell._linear
功能:Tensorflow:替換爲tf.nn.rnn_cell._linear(輸入,大小,0,範圍)
# highway layer that borrowed from https://github.com/carpedm20/lstm-char-cnn-tensorflow
def highway(input_, size, layer_size=1, bias=-2, f=tf.nn.relu):
"""Highway Network (cf. http://arxiv.org/abs/1505.00387).
t = sigmoid(Wy + b)
z = t * g(Wy + b) + (1 - t) * y
where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.
"""
output = input_
for idx in range(layer_size):
output = f(tf.nn.rnn_cell._linear(output, size, 0, scope='output_lin_%d' % idx)) #tf.contrib.layers.linear instad doesn't work either.
transform_gate = tf.sigmoid(tf.nn.rnn_cell._linear(input_, size, 0, scope='transform_lin_%d' % idx) + bias)
carry_gate = 1. - transform_gate
output = transform_gate * output + carry_gate * input_
return output
的tf.nn.rnn_cell._linear
功能不會出現在那裏了在Tensorflow 1.0或0.12中,我不知道如何替換它。我找不到任何這種新的實現,或tensorflow的github上的任何信息或(不幸的是非常稀疏)文檔。
有沒有人知道功能的新吊墜? 非常感謝!
爲什麼不爲你tf.contrib.layers.linear工作? –