transformer icon indicating copy to clipboard operation
transformer copied to clipboard

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

Open gaoxuezhao opened this issue 5 years ago • 4 comments

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

gaoxuezhao avatar Nov 06 '19 03:11 gaoxuezhao

Yes, I have this question too.

ZhichaoOuyang avatar Feb 16 '20 12:02 ZhichaoOuyang

+1

tracyfly avatar Feb 17 '20 10:02 tracyfly

+1

BetterZH avatar May 26 '20 12:05 BetterZH

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]

GuoshenLi avatar Jul 18 '21 04:07 GuoshenLi