Could you remove the inplace operations (such as seq -= (1 - mask) * 1e10) and rerun the code?
The different CPU/GPU (via cuDNN) implementations might have different requirements to store the unmodified forward activation.