Thank you very much for looking into this. The solution you mentioned works for me. I do hope though that later PyTorch builds will have a more generic solution to this problem.
Thank you once again for helping out.