Transformers, Pytorch, Machine Learning, Deep Dives, Data Science.
Target sequence length E = Model dimension Input encoded_x: (B, S, E) y: (B, L) with elements in (0, C) where C is num_classes Output (B, L, C) logits """ mask = (tgt == self.PAD_IDX).float() tgt_padding_mask = mask.masked_fill(mask == 1, float('-inf')) decoder_output = self.decoder( tgt=tgt,