Thanks. I did not work. I tried that before, and tried it again now, and still got the same error: RuntimeError: tensor must have one dimension at /py/conda-bld/pytorch_1493669264383/work/torch/lib/TH/generic/THTensor.c:814. I still could not get a minimal example to reproduce this error. The dimensions all seem to agree and the score computations work until the end of the sequence. When calling backward, it fails though. Any tips? It must be a different issue.