Kyubyong / transformer

A TensorFlow Implementation of the Transformer: Attention Is All You Need
Apache License 2.0
4.28k stars 1.3k forks source link

if tf.reduce_sum(y_hat, 1) == self.token2idx["<pad>"]: break #144

Open gaoxuezhao opened 5 years ago

gaoxuezhao commented 5 years ago

I don't understand the conditional sentence in the loop when infer, it is always false。

if tf.reduce_sum(y_hat, 1) == self.token2idx[""]: break

ZhichaoOuyang commented 4 years ago

Yes, I have this question too.

tracyfly commented 4 years ago

+1

BetterZH commented 4 years ago

+1

GuoshenLi commented 3 years ago

you are right. the author is wrong. I also think the following "decoder_inputs = tf.concat((decoder_inputs, y_hat), 1)" is wrong. cuz what we need to concat is not the total y_hat but the last time step of y_hat. so y_hat[:,-1]