Assertion error when using TransformerDecoder

Is this a correct implementation? Do we not need positional encoding and mask?

I have implemented in the similar way but I feel something is wrong.

https://discuss.pytorch.org/t/transformerencoder-and-transformerdecoder-based-text-encoder-decoder/166561