Week 4 Transformer create_padding_mask function

In the comments for create_padding_mask it says

Returns: mask -- (n, 1, 1, m) binary tensor

But the code says

return seq[:, tf.newaxis, :]

Which I think is (n,1,m) not (n, 1, 1, m) or have I misunderstood?

Hi @spm1001

The returned seq should be [:, tf.newaxis, tf.newaxis,:]
What you have posted here is incorrect.

1 Like