I don’t think that’s why this error occurs. There’re lots of in-place operations in Transformer, such as the line above scores.masked_fill_(attn_mask, -1e20), but none of them triggers this error. Is there something that I’ve missed?