Could you post your forward code here, or a minimal example of it that causes the error?
My first advice would be to check that you’re consistently using CUDA or CPU tensors, but it’s strange that
the forward pass doesn’t error out.