Write a PyTorch implementation of multi-head attention including a causal mask for autoregressive decoding.